Class JniConnection
- All Implemented Interfaces:
AutoCloseable,AdbcConnection,AdbcOptions
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.arrow.adbc.core.AdbcConnection
AdbcConnection.GetObjectsDepth -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbulkIngest(String targetTableName, BulkIngestMode mode) Create a new statement to bulk insert aVectorSchemaRootinto a table.bulkIngest(String targetTableName, BulkIngestMode mode, IngestOption... options) Create a new statement to bulk insert aVectorSchemaRootinto a table.voidcancel()Cancel execution of a query.voidclose()voidcommit()Commit the pending transaction.Create a new statement that can be executed.booleanGet the autocommit state.Get the current catalog.Get the current schema.getInfo(int @Nullable [] infoCodes) Get metadata about the driver/database.Get the isolation level used by transactions.getObjects(AdbcConnection.GetObjectsDepth depth, String catalogPattern, String dbSchemaPattern, String tableNamePattern, String[] tableTypes, String columnNamePattern) Get a hierarchical view of all catalogs, database schemas, tables, and columns.<T> TGet a generic option.booleanGet whether the connection is read-only.getTableSchema(String catalog, String dbSchema, String tableName) Get the Arrow schema of a database table.Get a list of table types supported by the database.readPartition(ByteBuffer descriptor) Create a result set from a serialized PartitionDescriptor.voidrollback()Rollback the pending transaction.voidsetAutoCommit(boolean enableAutoCommit) Toggle whether autocommit is enabled.voidsetCurrentCatalog(String catalog) Set the current catalog.voidsetCurrentDbSchema(String dbSchema) Set the current schema.voidsetIsolationLevel(IsolationLevel level) Change the isolation level used by transactions.<T> voidSet a generic option.voidsetReadOnly(boolean isReadOnly) Toggle whether the connection is read-only.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.arrow.adbc.core.AdbcConnection
getInfo, getInfo, getStatisticNames, getStatistics
-
Constructor Details
-
JniConnection
-
-
Method Details
-
createStatement
Description copied from interface:AdbcConnectionCreate a new statement that can be executed.- Specified by:
createStatementin interfaceAdbcConnection- Throws:
AdbcException
-
cancel
Description copied from interface:AdbcConnectionCancel execution of a query.This can be used to interrupt execution of a method like
AdbcConnection.getObjects(GetObjectsDepth, String, String, String, String[], String)}.This method must be thread-safe (other method are not necessarily thread-safe).
- Specified by:
cancelin interfaceAdbcConnection- Throws:
AdbcException
-
bulkIngest
Description copied from interface:AdbcConnectionCreate a new statement to bulk insert aVectorSchemaRootinto a table.Bind data to the statement, then call
AdbcStatement.executeUpdate(). SeeBulkIngestModefor description of behavior around creating tables.- Specified by:
bulkIngestin interfaceAdbcConnection- Throws:
AdbcException
-
bulkIngest
public AdbcStatement bulkIngest(String targetTableName, BulkIngestMode mode, IngestOption... options) throws AdbcException Description copied from interface:AdbcConnectionCreate a new statement to bulk insert aVectorSchemaRootinto a table.Bind data to the statement, then call
AdbcStatement.executeUpdate(). SeeBulkIngestModefor description of behavior around creating tables.- Specified by:
bulkIngestin interfaceAdbcConnection- Throws:
AdbcException
-
getInfo
Description copied from interface:AdbcConnectionGet metadata about the driver/database.- Specified by:
getInfoin interfaceAdbcConnection- Parameters:
infoCodes- The metadata items to fetch.- Throws:
AdbcException
-
getObjects
public ArrowReader getObjects(AdbcConnection.GetObjectsDepth depth, String catalogPattern, String dbSchemaPattern, String tableNamePattern, String[] tableTypes, String columnNamePattern) throws AdbcException Description copied from interface:AdbcConnectionGet a hierarchical view of all catalogs, database schemas, tables, and columns.The result is an Arrow dataset with the following schema:
Field Name Field Type catalog_name utf8 catalog_db_schemas list[DB_SCHEMA_SCHEMA] The definition of the GetObjects result schema. DB_SCHEMA_SCHEMA is a Struct with fields:
Field Name Field Type db_schema_name utf8 db_schema_tables list[TABLE_SCHEMA] The definition of DB_SCHEMA_SCHEMA. TABLE_SCHEMA is a Struct with fields:
Field Name Field Type table_name utf8 not null table_type utf8 not null table_columns list[COLUMN_SCHEMA] table_constraints list[CONSTRAINT_SCHEMA] The definition of TABLE_SCHEMA. COLUMN_SCHEMA is a Struct with fields:
Field Name Field Type Comments column_name utf8 not null ordinal_position int32 (1) remarks utf8 (2) xdbc_data_type int16 (3) xdbc_type_name utf8 (3) xdbc_column_size int32 (3) xdbc_decimal_digits int16 (3) xdbc_num_prec_radix int16 (3) xdbc_nullable int16 (3) xdbc_column_def utf8 (3) xdbc_sql_data_type int16 (3) xdbc_datetime_sub int16 (3) xdbc_char_octet_length int32 (3) xdbc_is_nullable utf8 (3) xdbc_scope_catalog utf8 (3) xdbc_scope_schema utf8 (3) xdbc_scope_table utf8 (3) xdbc_is_autoincrement bool (3) xdbc_is_generatedcolumn bool (3) The definition of COLUMN_SCHEMA. Notes:
- The column's ordinal position in the table (starting from 1).
- Database-specific description of the column.
- Optional value. Should be null if not supported by the driver. xdbc_ values are meant to provide JDBC/ODBC-compatible metadata in an agnostic manner.
CONSTRAINT_SCHEMA is a Struct with fields:
Field Name Field Type Comments constraint_name utf8 not null constraint_type utf8 not null (1) constraint_column_names list[utf8] not null (2) constraint_column_usage list[USAGE_SCHEMA] (3) The definition of CONSTRAINT_SCHEMA. - One of 'CHECK', 'FOREIGN KEY', 'PRIMARY KEY', or 'UNIQUE'.
- The columns on the current table that are constrained, in order.
- For FOREIGN KEY only, the referenced table and columns.
USAGE_SCHEMA is a Struct with fields:
Field Name Field Type fk_catalog utf8 fk_db_schema utf8 fk_table utf8 not null fk_column_name utf8 not null The definition of USAGE_SCHEMA. - Specified by:
getObjectsin interfaceAdbcConnection- Parameters:
depth- The level of nesting to display. If ALL, display all levels (up through columns). If CATALOGS, display only catalogs (i.e. catalog_schemas will be null), and so on. May be a search pattern (see class documentation).catalogPattern- Only show tables in the given catalog. If null, do not filter by catalog. If an empty string, only show tables without a catalog. May be a search pattern (see class documentation).dbSchemaPattern- Only show tables in the given database schema. If null, do not filter by database schema. If an empty string, only show tables without a database schema. May be a search pattern (see class documentation).tableNamePattern- Only show tables with the given name. If an empty string, only show tables without a catalog. May be a search pattern (see class documentation).tableTypes- Only show tables matching one of the given table types. If null, show tables of any type. Valid table types can be fetched fromAdbcConnection.getTableTypes().columnNamePattern- Only show columns with the given name. If null, do not filter by name. May be a search pattern (see class documentation).- Throws:
AdbcException
-
getTableSchema
public Schema getTableSchema(String catalog, String dbSchema, String tableName) throws AdbcException Description copied from interface:AdbcConnectionGet the Arrow schema of a database table.- Specified by:
getTableSchemain interfaceAdbcConnection- Parameters:
catalog- The catalog of the table (or null).dbSchema- The database schema of the table (or null).tableName- The table name.- Returns:
- The table schema.
- Throws:
AdbcException
-
getTableTypes
Description copied from interface:AdbcConnectionGet a list of table types supported by the database.The result is an Arrow dataset with the following schema:
Field Name Field Type table_type utf8 not null The definition of the result schema. - Specified by:
getTableTypesin interfaceAdbcConnection- Throws:
AdbcException
-
getReadOnly
Description copied from interface:AdbcConnectionGet whether the connection is read-only.Connections are not read-only by default.
- Specified by:
getReadOnlyin interfaceAdbcConnection- Throws:
AdbcException
-
setReadOnly
Description copied from interface:AdbcConnectionToggle whether the connection is read-only.- Specified by:
setReadOnlyin interfaceAdbcConnection- Throws:
AdbcException
-
getAutoCommit
Description copied from interface:AdbcConnectionGet the autocommit state.Connections start in autocommit mode by default.
- Specified by:
getAutoCommitin interfaceAdbcConnection- Throws:
AdbcException
-
setAutoCommit
Description copied from interface:AdbcConnectionToggle whether autocommit is enabled.- Specified by:
setAutoCommitin interfaceAdbcConnection- Throws:
AdbcException
-
getIsolationLevel
Description copied from interface:AdbcConnectionGet the isolation level used by transactions.- Specified by:
getIsolationLevelin interfaceAdbcConnection- Throws:
AdbcException
-
setIsolationLevel
Description copied from interface:AdbcConnectionChange the isolation level used by transactions.- Specified by:
setIsolationLevelin interfaceAdbcConnection- Throws:
AdbcException
-
commit
Description copied from interface:AdbcConnectionCommit the pending transaction.- Specified by:
commitin interfaceAdbcConnection- Throws:
AdbcException
-
rollback
Description copied from interface:AdbcConnectionRollback the pending transaction.- Specified by:
rollbackin interfaceAdbcConnection- Throws:
AdbcException- if a database error occurs
-
getCurrentCatalog
Description copied from interface:AdbcConnectionGet the current catalog.- Specified by:
getCurrentCatalogin interfaceAdbcConnection- Throws:
AdbcException
-
getCurrentDbSchema
Description copied from interface:AdbcConnectionGet the current schema.- Specified by:
getCurrentDbSchemain interfaceAdbcConnection- Throws:
AdbcException
-
setCurrentCatalog
Description copied from interface:AdbcConnectionSet the current catalog.- Specified by:
setCurrentCatalogin interfaceAdbcConnection- Throws:
AdbcException
-
setCurrentDbSchema
Description copied from interface:AdbcConnectionSet the current schema.- Specified by:
setCurrentDbSchemain interfaceAdbcConnection- Throws:
AdbcException
-
readPartition
Description copied from interface:AdbcConnectionCreate a result set from a serialized PartitionDescriptor.- Specified by:
readPartitionin interfaceAdbcConnection- Parameters:
descriptor- The descriptor to load (PartitionDescriptor.getDescriptor().- Returns:
- A statement that can be immediately executed.
- Throws:
AdbcException- See Also:
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
getOption
Description copied from interface:AdbcOptionsGet a generic option.- Specified by:
getOptionin interfaceAdbcOptions- Type Parameters:
T- The option value type.- Parameters:
key- The option to retrieve.- Returns:
- The option value.
- Throws:
AdbcException
-
setOption
Description copied from interface:AdbcOptionsSet a generic option.- Specified by:
setOptionin interfaceAdbcOptions- Type Parameters:
T- The option value type.- Parameters:
key- The option to set.value- The option value.- Throws:
AdbcException
-