Details
Description
Currently, org.apache.ignite.sql.Session interface does not bring any value, and can be confusing for the users:
- It is simply a property bag and does not hold any other state across queries;
- The same properties can be set on Statement;
- createSession is an extra step for the user;
- Some people, even AI3 developers, look at this API and assume something more, like holding open transactions on the server, etc.
To do:
- Move query execution methods from Session to IgniteSql;
- Remove Session interface.
public interface IgniteSql { ResultSet<SqlRow> execute(@Nullable Transaction transaction, String query, @Nullable Object... arguments); ResultSet<SqlRow> execute(@Nullable Transaction transaction, Statement statement, @Nullable Object... arguments); Statement.StatementBuilder statementBuilder(); ... }
Usage examples:
// Simple query in one line. sql.execute(null, "delete from my-table where id = ?", 1); // Statement. Statement statement = sql.statementBuilder() .query("select foo from bar") .pageSize(123) .defaultSchema("my-schema") .build(); ResultSet<SqlRow> result = sql.execute(null, statement); // Statement as a template (instead of Session as a common property holder). Statement statement2 = statement.toBuilder() .query("select foo from baz") .build();
Attachments
Issue Links
- incorporates
-
IGNITE-21544 Amend SQL related thread pools.
- Resolved
- is blocked by
-
IGNITE-21815 Make client handler to not use Session
- Resolved
- links to