[ 
https://issues.apache.org/jira/browse/IGNITE-21669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Konstantin Orlov updated IGNITE-21669:
--------------------------------------
    Fix Version/s: 3.0.0-beta2

> Remove sessions from SQL API
> ----------------------------
>
>                 Key: IGNITE-21669
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21669
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Igor Sapego
>            Assignee: Konstantin Orlov
>            Priority: Major
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>
> 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.
> {code:java}
> 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();
>    ...
> }
> {code}
> Usage examples: 
> {code:java}
> // 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();
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to