Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-21669

Remove sessions from SQL API

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0
    • sql
    • Docs Required, Release Notes Required

    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:

      1. Move query execution methods from Session to IgniteSql;
      2. 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

          Activity

            People

              korlov Konstantin Orlov
              isapego Igor Sapego
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 10m
                  10m