OracleDB#

Sync and async Oracle adapter using python-oracledb. Features native pipeline mode for multi-statement batching, BLOB support, and LOB coercion with byte-length thresholds.

Type Handling#

SQLSpec installs composable Oracle input and output handlers when a pooled connection is initialized. The handlers preserve Python values where the database has a matching native type and use explicit Oracle storage conventions where it does not.

Bind behavior#

Python value

Oracle bind/storage

Notes

dict or a non-numeric list/tuple

JSON storage selected for the server

Numeric sequences are reserved for VECTOR binding. An empty sequence is ambiguous and is not claimed automatically.

OracleJson

JSON storage selected for the server

Expresses JSON intent. It does not force DB_TYPE_JSON when the connected server does not expose native JSON storage.

OracleClob

DB_TYPE_CLOB

Bypasses the automatic string-size threshold.

OracleBlob

DB_TYPE_BLOB

Bypasses the automatic bytes-size threshold.

uuid.UUID

RAW(16)

Enabled by enable_uuid_binary=True.

NumPy array or a numeric Python sequence

VECTOR

Requires Oracle Database 23ai for VECTOR columns. Sparse vectors remain python-oracledb SparseVector values.

Read behavior#

Oracle column

Python value

Notes

native JSON

dict or list

python-oracledb performs native conversion. JSON numbers may be decimal.Decimal.

BLOB/CLOB/character data marked IS JSON

dict or list

SQLSpec uses fetch metadata to decode JSON. Textual JSON number lanes produce ordinary int/float values.

OSON BLOB

dict or list

Decoded through python-oracledb when OSON metadata and support are available.

unconstrained BLOB/CLOB

bytes/str or a LOB locator

JSON-looking contents are not decoded without JSON metadata.

RAW(16)

uuid.UUID

Other RAW widths remain bytes.

VECTOR

NumPy array, list, or array.array

Controlled by vector_return_format.

JSON Storage By Oracle Version#

The server version selects the automatic JSON bind rung:

Oracle Database

Automatic JSON bind

Coverage and constraints

21c and newer, including 23ai

native JSON / DB_TYPE_JSON

The repository integration lane exercises 23ai. Native JSON numbers may be returned as decimal.Decimal.

12c through 20c, including 18c and 19c

BLOB with IS JSON

The automated compatibility lane uses Oracle 18c because the pinned pytest-databases release does not provide a 19c service fixture.

11g and earlier

CLOB

Capability fallback only; it is not part of the automated service matrix.

BLOB IS JSON is the preferred pre-native JSON storage because UTF-8 byte storage avoids CLOB character-set conversion and typically uses less space for JSON. Keep CLOB storage as an explicit compatibility or application choice.

Explicit CLOB CHECK (payload IS JSON) columns remain readable through metadata-driven conversion on supported servers. For BLOB IS JSON storage, SQLSpec serializes direct Python JSON values to UTF-8 and binds a BLOB locator; callers do not need to provide serialized strings.

Driver Feature Escape Hatches#

Pass these keys through driver_features on OracleSyncConfig or OracleAsyncConfig:

Key

Default

Effect

fetch_lobs

False

Return supported LOB values directly; set True to request native locators.

fetch_decimals

driver default

Request Decimal NUMBER results where python-oracledb supports them.

enable_uuid_binary

True

Convert between uuid.UUID and RAW(16).

enable_numpy_vectors

whether NumPy is installed

Enable NumPy VECTOR conversion.

vector_return_format

"numpy" with NumPy, otherwise "list"

Choose "numpy", "list", or "array" for dense VECTOR results.

oracle_varchar2_byte_limit

4000

Route larger UTF-8 strings to CLOB; installations using MAX_STRING_SIZE=EXTENDED may choose 32767.

oracle_raw_byte_limit

2000

Route larger byte payloads to BLOB.

arraysize / prefetchrows

python-oracledb defaults

Override per-cursor fetch buffering.

enable_lowercase_column_names

True

Normalize implicit uppercase Oracle identifiers for result mappings.

LOB And JSON Fetching#

Oracle configurations default fetch_lobs to False. With modern python-oracledb this returns supported LOB values under Oracle's 1 GB direct-fetch ceiling directly as str or bytes for normal SELECTs, streaming reads, and Arrow exports. SQLSpec still materializes readable locators when Oracle returns one, so buffered results and schema hydration do not expose driver handles by default.

Pass fetch_lobs=True on a query when application code needs native Oracle LOB locators, for example in a streaming workflow that wants to control when a large value is read.

JSON fetch conversion is metadata-driven:

  • native JSON columns are returned by python-oracledb;

  • IS JSON CLOB/BLOB/VARCHAR2 columns are decoded through Oracle fetch metadata;

  • OSON BLOB values are decoded through Oracle's OSON support when the server and driver expose it.

Unconstrained CLOB or BLOB columns are returned as text or bytes even when their contents look like JSON. Add an Oracle JSON type or IS JSON constraint when you want automatic JSON decoding.

MERGE Upserts#

Oracle uses MERGE for an update-or-insert operation. PostgreSQL INSERT ... ON CONFLICT syntax is not valid Oracle SQL, and SQLSpec does not rewrite it into MERGE. For a single row, select the named bind values from DUAL and use the same source aliases in both branches:

merge_widget = """
MERGE INTO widget t
USING (
    SELECT :sku AS sku, :name AS name, :quantity AS quantity
    FROM DUAL
) s
ON (t.sku = s.sku)
WHEN MATCHED THEN
    UPDATE SET
        t.name = s.name,
        t.quantity = s.quantity,
        t.updated_at = SYSTIMESTAMP
WHEN NOT MATCHED THEN
    INSERT (id, sku, name, quantity, created_at, updated_at)
    VALUES (
        widget_seq.NEXTVAL,
        s.sku,
        s.name,
        s.quantity,
        SYSTIMESTAMP,
        SYSTIMESTAMP
    )
"""

await session.execute(
    merge_widget,
    {"sku": "W-100", "name": "Widget", "quantity": 3},
)

Do not add RETURNING to this MERGE. When the caller needs an ID generated by the insert branch, select it by the same unique key before the transaction is committed:

widget_id = await session.select_value(
    "SELECT id FROM widget WHERE sku = :sku",
    {"sku": "W-100"},
)

Keeping the MERGE and follow-up SELECT in one SQLSpec session preserves their transaction boundary. For large LOB values, the adapter's Litestar session store uses the same pattern to merge an EMPTY_BLOB(), select it FOR UPDATE, and write through the returned locator.

Extension Table Storage Options#

Oracle ADK, durable event, and Litestar session tables support the same opt-in storage concepts under their extension configuration: in_memory, compression, partitioning, and table options. For example, an events queue can use Advanced Compression and monthly interval partitions:

extension_config = {
    "events": {
        "compression": {"enabled": True, "algorithm": "advanced"},
        "partitioning": {
            "strategy": "range",
            "partition_key": "available_at",
            "interval": "month",
        },
        "table_options": "TABLESPACE event_data",
    }
}

Use the same keys under litestar; range partitioning defaults to expires_at. Under adk, per-table options use names such as session_table_options, events_table_options, and memory_table_options. ADK partition settings can likewise override a specific table key with session_partition_key, events_partition_key, or the corresponding state or memory key.

SQLSpec resolves Oracle Partitioning, Advanced Compression, Basic Compression, and Database In-Memory availability once per connection pool through the data dictionary. If the option catalog is inaccessible or a requested feature is not available, SQLSpec logs a structured warning and creates the table without that optimization. User-provided table options are still emitted because they are application DDL rather than a capability-detected Oracle option.

SQLSpec does not automatically add SECUREFILE LOB compression. Its safety also depends on tablespace segment-space management and database-level DB_SECUREFILE policy, which cannot be established from the option catalog alone. Add a reviewed LOB clause through the table-options setting when the deployment guarantees those prerequisites.

Sync Configuration#

class sqlspec.adapters.oracledb.OracleSyncConfig[source]#

Bases: SyncDatabaseConfig[Connection, OracleSyncConnectionPool, OracleSyncDriver]

Configuration for Oracle synchronous database connections.

driver_type#

alias of OracleSyncDriver

migration_tracker_type#

alias of OracleSyncMigrationTracker

__init__(*, connection_config=None, connection_instance=None, migration_config=None, statement_config=None, driver_features=None, bind_key=None, extension_config=None, **kwargs)[source]#

Initialize Oracle synchronous configuration.

Parameters:
  • connection_config -- Connection and pool configuration parameters.

  • connection_instance -- Existing pool instance to use.

  • migration_config -- Migration configuration.

  • statement_config -- Default SQL statement configuration.

  • driver_features -- Optional driver feature configuration (TypedDict or dict).

  • bind_key -- Optional unique identifier for this configuration.

  • extension_config -- Extension-specific configuration.

  • **kwargs -- Additional keyword arguments.

create_connection()[source]#

Create a single connection (not from pool).

Return type:

Connection

Returns:

An Oracle Connection instance.

provide_pool()[source]#

Provide pool instance.

Return type:

ConnectionPool

Returns:

The connection pool.

get_signature_namespace()[source]#

Get the signature namespace for OracleDB types.

Provides OracleDB-specific types for Litestar framework recognition.

Return type:

dict[str, typing.Any]

Returns:

Dictionary mapping type names to types.

get_event_runtime_hints()[source]#

Return polling defaults for Oracle table-backed event queues.

Return type:

EventRuntimeHints

Async Configuration#

class sqlspec.adapters.oracledb.OracleAsyncConfig[source]#

Bases: AsyncDatabaseConfig[AsyncConnection, OracleAsyncConnectionPool, OracleAsyncDriver]

Configuration for Oracle asynchronous database connections.

driver_type#

alias of OracleAsyncDriver

migration_tracker_type#

alias of OracleAsyncMigrationTracker

__init__(*, connection_config=None, connection_instance=None, migration_config=None, statement_config=None, driver_features=None, bind_key=None, extension_config=None, **kwargs)[source]#

Initialize Oracle asynchronous configuration.

Parameters:
  • connection_config -- Connection and pool configuration parameters.

  • connection_instance -- Existing pool instance to use.

  • migration_config -- Migration configuration.

  • statement_config -- Default SQL statement configuration.

  • driver_features -- Optional driver feature configuration (TypedDict or dict).

  • bind_key -- Optional unique identifier for this configuration.

  • extension_config -- Extension-specific configuration.

  • **kwargs -- Additional keyword arguments.

async create_connection()[source]#

Create a single async connection (not from pool).

Return type:

AsyncConnection

Returns:

An Oracle AsyncConnection instance.

async provide_pool()[source]#

Provide async pool instance.

Return type:

AsyncConnectionPool

Returns:

The async connection pool.

get_signature_namespace()[source]#

Get the signature namespace for OracleAsyncConfig types.

Return type:

dict[str, typing.Any]

Returns:

Dictionary mapping type names to types.

get_event_runtime_hints()[source]#

Return polling defaults for Oracle table-backed event queues.

Return type:

EventRuntimeHints

Sync Driver#

class sqlspec.adapters.oracledb.OracleSyncDriver[source]#

Bases: OraclePipelineMixin, SyncDriverAdapterBase

Synchronous Oracle Database driver.

Provides Oracle Database connectivity with parameter style conversion, error handling, and transaction management.

__init__(connection, statement_config=None, driver_features=None)[source]#
dispatch_execute(cursor, statement)[source]#

Execute single SQL statement with Oracle data handling.

For SELECT-like statements, fetches all rows, resolves row metadata, and applies LOB coercion if needed. For non-SELECT statements, resolves and returns the affected row count.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL statement to execute

Return type:

ExecutionResult

Returns:

Execution result containing data for SELECT statements or row count for others

dispatch_execute_many(cursor, statement)[source]#

Execute SQL with multiple parameter sets using Oracle batch processing.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL statement with multiple parameter sets

Return type:

ExecutionResult

Returns:

Execution result with affected row count

dispatch_execute_script(cursor, statement)[source]#

Execute SQL script with statement splitting and parameter handling.

Parameters are embedded as static values for script execution compatibility.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL script statement to execute

Return type:

ExecutionResult

Returns:

Execution result containing statement count and success information

begin()[source]#

Begin a database transaction.

Oracle starts a transaction implicitly on the first DML, so no explicit statement is issued; the active-transaction flag is set here.

Return type:

None

commit()[source]#

Commit the current transaction.

Raises:

SQLSpecError -- If commit fails

Return type:

None

rollback()[source]#

Rollback the current transaction.

Raises:

SQLSpecError -- If rollback fails

Return type:

None

set_migration_session_schema(schema)[source]#

Set Oracle CURRENT_SCHEMA for migration SQL.

Return type:

None

has_schema(schema)[source]#

Return whether an Oracle schema/user exists.

Return type:

bool

with_cursor(connection)[source]#

Create context manager for Oracle cursor.

Parameters:

connection (Connection) -- Oracle database connection

Return type:

OracleSyncCursor

Returns:

Context manager for cursor operations

select_stream(statement, /, *parameters, schema_type=None, statement_config=None, chunk_size=1000, native_only=False, **kwargs)[source]#

Execute a query and stream rows in chunks with Oracle fetch tuning.

Overloads:
  • self, statement (SQL | Statement | QueryBuilder), parameters (StatementParameters | StatementFilter), schema_type (type[SchemaT]), statement_config (StatementConfig | None), chunk_size (int), native_only (bool), kwargs (Any) → SyncRowStream[SchemaT]

  • self, statement (SQL | Statement | QueryBuilder), parameters (StatementParameters | StatementFilter), schema_type (None), statement_config (StatementConfig | None), chunk_size (int), native_only (bool), kwargs (Any) → SyncRowStream[dict[str, Any]]

dispatch_select_stream(statement, chunk_size, fetch_lobs=None)[source]#

Return a native oracledb row stream backed by chunked fetchmany.

Return type:

Optional[SyncRowStream[dict[str, typing.Any]]]

handle_database_exceptions()[source]#

Handle database-specific exceptions and wrap them appropriately.

Return type:

OracleSyncExceptionHandler

select_to_arrow(statement, /, *parameters, statement_config=None, return_format='table', native_only=False, batch_size=None, arrow_schema=None, **kwargs)[source]#

Execute query and return results as Apache Arrow format using Oracle native support.

This implementation uses Oracle's native execute_df()/fetch_df_all() methods which return OracleDataFrame objects with Arrow PyCapsule interface, providing zero-copy data transfer and 5-10x performance improvement over dict conversion. If native Arrow is unavailable and native_only is False, it falls back to the conversion path.

Parameters:
  • statement -- SQL query string, Statement, or QueryBuilder

  • *parameters -- Query parameters (same format as execute()/select())

  • statement_config -- Optional statement configuration override

  • return_format -- "table" for pyarrow.Table (default), "batch" for RecordBatch, "batches" for list of RecordBatch, "reader" for RecordBatchReader

  • native_only -- If True, raise error if native Arrow is unavailable

  • batch_size -- Rows per batch when using "batch" or "batches" format

  • arrow_schema -- Optional pyarrow.Schema for type casting

  • **kwargs -- Additional keyword arguments

Returns:

ArrowResult containing pyarrow.Table or RecordBatch

execute_stack(stack, *, continue_on_error=False)[source]#

Execute a StatementStack using Oracle's pipeline when available.

Return type:

tuple[StackResult, ...]

select_to_storage(statement, destination, /, *parameters, statement_config=None, partitioner=None, format_hint=None, telemetry=None, **kwargs)[source]#

Execute a query and stream Arrow-formatted output to storage (sync).

load_from_arrow(table, source, *, partitioner=None, overwrite=False, telemetry=None)[source]#

Load Arrow data into Oracle using batched executemany calls.

Return type:

StorageBridgeJob

load_from_storage(table, source, *, file_format, partitioner=None, overwrite=False)[source]#

Load staged artifacts into Oracle.

Return type:

StorageBridgeJob

property data_dictionary: OracledbSyncDataDictionary#

Get the data dictionary for this driver.

Returns:

Data dictionary instance for metadata queries

collect_rows(cursor, fetched)[source]#

Collect Oracle sync rows for the direct execution path.

Return type:

tuple[list[typing.Any], list[str], int]

resolve_rowcount(cursor)[source]#

Resolve rowcount from Oracle cursor for the direct execution path.

Return type:

int

Async Driver#

class sqlspec.adapters.oracledb.OracleAsyncDriver[source]#

Bases: OraclePipelineMixin, AsyncDriverAdapterBase

Asynchronous Oracle Database driver.

Provides Oracle Database connectivity with parameter style conversion, error handling, and transaction management for async operations.

__init__(connection, statement_config=None, driver_features=None)[source]#
async dispatch_execute(cursor, statement)[source]#

Execute single SQL statement with Oracle data handling.

For SELECT-like statements, fetches all rows, resolves row metadata, and applies LOB coercion if needed. For non-SELECT statements, resolves and returns the affected row count.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL statement to execute

Return type:

ExecutionResult

Returns:

Execution result containing data for SELECT statements or row count for others

async dispatch_execute_many(cursor, statement)[source]#

Execute SQL with multiple parameter sets using Oracle batch processing.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL statement with multiple parameter sets

Return type:

ExecutionResult

Returns:

Execution result with affected row count

async dispatch_execute_script(cursor, statement)[source]#

Execute SQL script with statement splitting and parameter handling.

Parameters are embedded as static values for script execution compatibility.

Parameters:
  • cursor (Any) -- Oracle cursor object

  • statement (SQL) -- SQL script statement to execute

Return type:

ExecutionResult

Returns:

Execution result containing statement count and success information

async begin()[source]#

Begin a database transaction.

Oracle starts a transaction implicitly on the first DML, so no explicit statement is issued; the active-transaction flag is set here.

Return type:

None

async commit()[source]#

Commit the current transaction.

Raises:

SQLSpecError -- If commit fails

Return type:

None

async rollback()[source]#

Rollback the current transaction.

Raises:

SQLSpecError -- If rollback fails

Return type:

None

async set_migration_session_schema(schema)[source]#

Set Oracle CURRENT_SCHEMA for migration SQL.

Return type:

None

async has_schema(schema)[source]#

Return whether an Oracle schema/user exists.

Return type:

bool

with_cursor(connection)[source]#

Create context manager for Oracle cursor.

Parameters:

connection (AsyncConnection) -- Oracle database connection

Return type:

OracleAsyncCursor

Returns:

Context manager for cursor operations

select_stream(statement, /, *parameters, schema_type=None, statement_config=None, chunk_size=1000, native_only=False, **kwargs)[source]#

Execute a query and stream rows in chunks with Oracle fetch tuning.

Overloads:
  • self, statement (SQL | Statement | QueryBuilder), parameters (StatementParameters | StatementFilter), schema_type (type[SchemaT]), statement_config (StatementConfig | None), chunk_size (int), native_only (bool), kwargs (Any) → AsyncRowStream[SchemaT]

  • self, statement (SQL | Statement | QueryBuilder), parameters (StatementParameters | StatementFilter), schema_type (None), statement_config (StatementConfig | None), chunk_size (int), native_only (bool), kwargs (Any) → AsyncRowStream[dict[str, Any]]

dispatch_select_stream(statement, chunk_size, fetch_lobs=None)[source]#

Return a native oracledb row stream backed by chunked fetchmany.

Return type:

Optional[AsyncRowStream[dict[str, typing.Any]]]

handle_database_exceptions()[source]#

Handle database-specific exceptions and wrap them appropriately.

Return type:

OracleAsyncExceptionHandler

async select_to_arrow(statement, /, *parameters, statement_config=None, return_format='table', native_only=False, batch_size=None, arrow_schema=None, **kwargs)[source]#

Execute query and return results as Apache Arrow format using Oracle native support.

This implementation uses Oracle's native execute_df()/fetch_df_all() methods which return OracleDataFrame objects with Arrow PyCapsule interface, providing zero-copy data transfer and 5-10x performance improvement over dict conversion. If native Arrow is unavailable and native_only is False, it falls back to the conversion path.

Parameters:
  • statement -- SQL query string, Statement, or QueryBuilder

  • *parameters -- Query parameters (same format as execute()/select())

  • statement_config -- Optional statement configuration override

  • return_format -- "table" for pyarrow.Table (default), "batch" for RecordBatch, "batches" for list of RecordBatch, "reader" for RecordBatchReader

  • native_only -- If True, raise error if native Arrow is unavailable

  • batch_size -- Rows per batch when using "batch" or "batches" format

  • arrow_schema -- Optional pyarrow.Schema for type casting

  • **kwargs -- Additional keyword arguments

Returns:

ArrowResult containing pyarrow.Table or RecordBatch

async execute_stack(stack, *, continue_on_error=False)[source]#

Execute a StatementStack using Oracle's pipeline when available.

Return type:

tuple[StackResult, ...]

async select_to_storage(statement, destination, /, *parameters, statement_config=None, partitioner=None, format_hint=None, telemetry=None, **kwargs)[source]#

Execute a query and write Arrow-compatible output to storage (async).

async load_from_arrow(table, source, *, partitioner=None, overwrite=False, telemetry=None)[source]#

Asynchronously load Arrow data into Oracle.

Return type:

StorageBridgeJob

async load_from_storage(table, source, *, file_format, partitioner=None, overwrite=False)[source]#

Asynchronously load staged artifacts into Oracle.

Return type:

StorageBridgeJob

property data_dictionary: OracledbAsyncDataDictionary#

Get the data dictionary for this driver.

Returns:

Data dictionary instance for metadata queries

collect_rows(cursor, fetched)[source]#

Collect Oracle async rows for the direct execution path.

Falls back to the standard async dispatch path when rows contain async LOB locators, because those must be read with collect_async_rows.

Return type:

tuple[list[typing.Any], list[str], int]

resolve_rowcount(cursor)[source]#

Resolve rowcount from Oracle cursor for the direct execution path.

Return type:

int

Data Dictionary#

class sqlspec.adapters.oracledb.data_dictionary.OracleVersionInfo[source]#

Bases: VersionInfo

Oracle database version information.

__init__(major, minor=0, patch=0, compatible=None, is_autonomous=False)[source]#

Initialize Oracle version info.

Parameters:
  • major (int) -- Major version number.

  • minor (int) -- Minor version number.

  • patch (int) -- Patch version number.

  • compatible (str | None) -- Compatible parameter value.

  • is_autonomous (bool) -- Whether this is an Autonomous Database.

property compatible_major: int | None#

Get major version from compatible parameter.

supports_native_json()[source]#

Check if database supports native JSON data type.

Return type:

bool

supports_oson_blob()[source]#

Check if database supports BLOB with OSON format.

Return type:

bool

supports_json_blob()[source]#

Check if database supports BLOB with JSON validation.

Return type:

bool

__str__()[source]#

String representation of version info.

Return type:

str

class sqlspec.adapters.oracledb.data_dictionary.OracledbSyncDataDictionary[source]#

Bases: SyncDataDictionaryBase

Oracle-specific sync data dictionary.

dialect: ClassVar[str] = 'oracle'#

Dialect identifier. Must be defined by subclasses as a class attribute.

__init__()[source]#
get_dialect_config()[source]#

Return the dialect configuration for this data dictionary.

Return type:

DialectConfig

resolve_schema(schema)[source]#

Return a schema name using dialect defaults when missing.

Return type:

str | None

list_available_features()[source]#

List all features that can be checked via get_feature_flag.

Return type:

list[str]

Returns:

List of feature names this data dictionary supports

get_metadata_capabilities(driver, domains=None, *, include_privileged=False, include_diagnostics=False, acknowledge_diagnostics_license=False)[source]#

Report Oracle replacement metadata capabilities and scope gates.

Return type:

MetadataCapabilityProfile

get_system_metadata_capabilities(driver, domains=None)[source]#

Get Oracle opt-in system metadata capability disclosures.

Return type:

tuple[SystemMetadataCapability, ...]

get_ddl(driver, object_name, schema=None, *, object_type='TABLE', include_dependencies=True, prefer_native=True, redact=True)[source]#

Get native Oracle DDL using DBMS_METADATA.

Return type:

DDLResult

get_system_metadata(driver, request=None, **kwargs)[source]#

Return Oracle system metadata only when diagnostics gates are accepted.

Return type:

SystemMetadataResult

get_schemas(driver)[source]#

Get Oracle user/schema metadata.

Return type:

MetadataResult

get_objects(driver, schema=None)[source]#

Get Oracle object metadata from ALL_OBJECTS.

Return type:

MetadataResult

get_table_details(driver, table, schema=None)[source]#

Get rich Oracle table metadata.

Return type:

MetadataResult

get_constraints(driver, table=None, schema=None)[source]#

Get Oracle constraint metadata.

Return type:

MetadataResult

get_views(driver, schema=None)[source]#

Get Oracle view metadata.

Return type:

MetadataResult

get_materialized_views(driver, schema=None)[source]#

Get Oracle materialized view metadata.

Return type:

MetadataResult

get_sequences(driver, schema=None)[source]#

Get Oracle sequence metadata.

Return type:

MetadataResult

get_routines(driver, schema=None)[source]#

Get Oracle routine, package, procedure, and function metadata.

Return type:

MetadataResult

get_triggers(driver, schema=None)[source]#

Get Oracle trigger metadata.

Return type:

MetadataResult

get_privileges(driver, object_name=None, schema=None)[source]#

Get Oracle table and column grants.

Return type:

MetadataResult

get_dependencies(driver, object_name=None, schema=None)[source]#

Get Oracle dependency metadata.

Return type:

MetadataResult

get_partitions(driver, table=None, schema=None)[source]#

Get Oracle partition and storage metadata.

Return type:

MetadataResult

get_lob_storage(driver, table=None, schema=None)[source]#

Get Oracle LOB storage metadata.

Return type:

MetadataResult

get_version(driver)[source]#

Get Oracle database version information through the pool-scoped cache.

Return type:

OracleVersionInfo | None

get_storage_capabilities(driver)[source]#

Return pool-scoped Oracle storage-option capabilities.

An unavailable option catalog degrades to an all-false capability set. The reason is stored on the same pool-scoped holder as the version.

Return type:

OracleStorageCapabilities

get_feature_flag(driver, feature)[source]#

Check if Oracle database supports a specific feature.

Return type:

bool

get_optimal_type(driver, type_category)[source]#

Get optimal Oracle type for a category.

Return type:

str

get_tables(driver, schema=None)[source]#

Get tables sorted by dependency order with full coverage.

Return type:

list[TableMetadata]

get_columns(driver, table=None, schema=None)[source]#

Get column information for a table or schema.

Return type:

list[ColumnMetadata]

get_indexes(driver, table=None, schema=None)[source]#

Get index metadata for a table or schema.

Return type:

list[IndexMetadata]

get_foreign_keys(driver, table=None, schema=None)[source]#

Get foreign key metadata.

Return type:

list[ForeignKeyMetadata]

class sqlspec.adapters.oracledb.data_dictionary.OracledbAsyncDataDictionary[source]#

Bases: AsyncDataDictionaryBase

Oracle-specific async data dictionary.

dialect: ClassVar[str] = 'oracle'#

Dialect identifier. Must be defined by subclasses as a class attribute.

__init__()[source]#
get_dialect_config()[source]#

Return the dialect configuration for this data dictionary.

Return type:

DialectConfig

resolve_schema(schema)[source]#

Return a schema name using dialect defaults when missing.

Return type:

str | None

list_available_features()[source]#

List all features that can be checked via get_feature_flag.

Return type:

list[str]

Returns:

List of feature names this data dictionary supports

async get_metadata_capabilities(driver, domains=None, *, include_privileged=False, include_diagnostics=False, acknowledge_diagnostics_license=False)[source]#

Report Oracle replacement metadata capabilities and scope gates.

Return type:

MetadataCapabilityProfile

async get_system_metadata_capabilities(driver, domains=None)[source]#

Get Oracle opt-in system metadata capability disclosures.

Return type:

tuple[SystemMetadataCapability, ...]

async get_ddl(driver, object_name, schema=None, *, object_type='TABLE', include_dependencies=True, prefer_native=True, redact=True)[source]#

Get native Oracle DDL using DBMS_METADATA.

Return type:

DDLResult

async get_system_metadata(driver, request=None, **kwargs)[source]#

Return Oracle system metadata only when diagnostics gates are accepted.

Return type:

SystemMetadataResult

async get_schemas(driver)[source]#

Get Oracle user/schema metadata.

Return type:

MetadataResult

async get_objects(driver, schema=None)[source]#

Get Oracle object metadata from ALL_OBJECTS.

Return type:

MetadataResult

async get_table_details(driver, table, schema=None)[source]#

Get rich Oracle table metadata.

Return type:

MetadataResult

async get_constraints(driver, table=None, schema=None)[source]#

Get Oracle constraint metadata.

Return type:

MetadataResult

async get_views(driver, schema=None)[source]#

Get Oracle view metadata.

Return type:

MetadataResult

async get_materialized_views(driver, schema=None)[source]#

Get Oracle materialized view metadata.

Return type:

MetadataResult

async get_sequences(driver, schema=None)[source]#

Get Oracle sequence metadata.

Return type:

MetadataResult

async get_routines(driver, schema=None)[source]#

Get Oracle routine, package, procedure, and function metadata.

Return type:

MetadataResult

async get_triggers(driver, schema=None)[source]#

Get Oracle trigger metadata.

Return type:

MetadataResult

async get_privileges(driver, object_name=None, schema=None)[source]#

Get Oracle table and column grants.

Return type:

MetadataResult

async get_dependencies(driver, object_name=None, schema=None)[source]#

Get Oracle dependency metadata.

Return type:

MetadataResult

async get_partitions(driver, table=None, schema=None)[source]#

Get Oracle partition and storage metadata.

Return type:

MetadataResult

async get_lob_storage(driver, table=None, schema=None)[source]#

Get Oracle LOB storage metadata.

Return type:

MetadataResult

async get_version(driver)[source]#

Get Oracle database version information through the pool-scoped cache.

Return type:

OracleVersionInfo | None

async get_storage_capabilities(driver)[source]#

Return pool-scoped Oracle storage-option capabilities.

Return type:

OracleStorageCapabilities

async get_feature_flag(driver, feature)[source]#

Check if Oracle database supports a specific feature.

Return type:

bool

async get_optimal_type(driver, type_category)[source]#

Get optimal Oracle type for a category.

Return type:

str

async get_tables(driver, schema=None)[source]#

Get tables sorted by dependency order with full coverage.

Return type:

list[TableMetadata]

async get_columns(driver, table=None, schema=None)[source]#

Get column information for a table or schema.

Return type:

list[ColumnMetadata]

async get_indexes(driver, table=None, schema=None)[source]#

Get index metadata for a table or schema.

Return type:

list[IndexMetadata]

async get_foreign_keys(driver, table=None, schema=None)[source]#

Get foreign key metadata.

Return type:

list[ForeignKeyMetadata]