Skip to content

teradata Adapter

from sqlspec.adapters.teradata import (
    TeradataConfig,
    TeradataConnectionParams,
    TeradataConnectionPool,
    TeradataDriver,
    TeradataDriverFeatures,
    TeradataExceptionHandler,
    TeradataPoolParams,
    TeradataSyncDataDictionary,
    TeradataSyncMigrationTracker,
)

Synchronous Teradata Vantage adapter using teradatasql. See the setup guide and catalog reference.

Configuration & Parameters

TeradataConfig

Bases: SyncDatabaseConfig[TeradataConnection, TeradataConnectionPool, TeradataDriver]

Configuration for Teradata Vantage synchronous connections over teradatasql.

TeradataConnectionParams

Bases: TypedDict

Native teradatasql connection options.

Attributes:

Name Type Description
host str

Teradata server hostname.

user str

Native authentication user.

username str

Friendly authentication user alias.

password str

Authentication password.

database str

Default database.

dbs_port str

Native server port.

port int | str

Friendly server port alias.

autocommit bool

Initial transaction autocommit state.

logmech TeradataLogMech

Authentication mechanism.

tmode TeradataTransactionMode

Transaction mode.

sslmode TeradataSSLMode

TLS verification mode.

encryptdata bool | str

Enable encrypted data transport.

account NotRequired[str]

Teradata workload management account string.

logdata NotRequired[str]

Mechanism-specific authentication payload.

charset NotRequired[str]

Session character set.

sslca NotRequired[str]

Path to CA certificate bundle file.

sslcapath NotRequired[str]

Path to CA certificate directory.

lob_support NotRequired[bool | str]

Enable LOB streaming support.

connect_timeout NotRequired[int | float | str]

Connection establishment timeout.

request_timeout NotRequired[int | float | str]

Statement request timeout.

sJson NotRequired[str]

Raw teradatasql JSON connection payload.

cop NotRequired[bool | str]

Enable COP discovery.

coplast NotRequired[bool | str]

Retry last COP entry.

https_port NotRequired[int | str]

HTTPS port for TLS/OAuth connections.

extra dict[str, Any]

Additional vendor options.

TeradataPoolParams

Bases: TeradataConnectionParams

Teradata Vantage pool parameters.

Attributes:

Name Type Description
pool_min_size NotRequired[int]

Minimum number of connections maintained in the pool.

pool_max_size NotRequired[int]

Maximum number of connections allowed in the pool.

pool_timeout NotRequired[float]

Seconds to wait for a connection before timing out.

pool_recycle_seconds NotRequired[int]

Maximum age in seconds before a connection is recycled.

health_check_interval NotRequired[float]

Interval in seconds between background health checks.

TeradataDriverFeatures

Bases: TypedDict

Teradata Vantage driver feature flags.

Attributes:

Name Type Description
json_serializer NotRequired[Callable[[Any], str]]

Custom callable for serializing objects to JSON strings.

json_deserializer NotRequired[Callable[[str], Any]]

Custom callable for deserializing JSON strings.

on_connection_create NotRequired[Callable[[TeradataConnection], None]]

Callback invoked immediately when a new connection is established.

arraysize NotRequired[int]

DB-API row fetch chunk size.

enable_lowercase_column_names NotRequired[bool]

Fold implicit uppercase column names.

enable_fastexport NotRequired[bool]

Attempt native FastExport for reads.

enable_fastload NotRequired[bool]

Attempt native FastLoad for inserts.

query_band NotRequired[Mapping[str, str] | str]

Session query-band metadata.

enable_events NotRequired[bool]

Enable database event listening.

events_backend NotRequired[Literal['poll_queue']]

Backend mechanism used for dispatching events.

Driver, Pool & Data Dictionary

TeradataDriver

Bases: SyncDriverAdapterBase

Teradata Vantage database driver using teradatasql.

TeradataExceptionHandler

Bases: BaseSyncExceptionHandler

Context manager for handling Teradata Vantage teradatasql exceptions.

TeradataConnectionPool

Lazily allocate exclusive leases with bounded capacity and fork refusal.

TeradataSyncDataDictionary

Bases: SyncDataDictionaryBase

Synchronous Teradata Vantage data dictionary.

TeradataSyncMigrationTracker

Bases: SyncMigrationTracker

Track migrations using bounded Teradata metadata columns.

Extension Stores & Configs

TeradataStore

Bases: BaseSQLSpecStore['TeradataConfig']

Teradata Vantage-backed session store using teradatasql sync sessions.

TeradataADKStore

Bases: BaseSyncADKStore['TeradataConfig']

Synchronous Teradata Vantage ADK session/event store.

TeradataADKMemoryStore

Bases: BaseSyncADKMemoryStore['TeradataConfig']

Teradata Vantage ADK memory store using teradatasql.

TeradataEventQueueStore

Bases: BaseEventQueueStore[TeradataConfig]

Teradata Vantage event queue store with a catalog-checked secondary index.

The queue table and index use plain CREATE statements; the events migration checks the catalog for the table and the index before running them.

Driver Option Types

TeradataLogMech

TeradataLogMech = Literal[
    "TD2",
    "LDAP",
    "TDNEGO",
    "KRB5",
    "BROWSER",
    "JWT",
    "BEARER",
    "CODE",
    "CRED",
    "ROPC",
    "SECRET",
]

TeradataSSLMode

TeradataSSLMode = Literal[
    "disable", "allow", "prefer", "require", "verify-ca", "verify-full"
]

TeradataTransactionMode

TeradataTransactionMode = Literal['ANSI', 'TERA', 'DEFAULT']