Skip to content

sybase Adapter

from sqlspec.adapters.sybase import (
    SybaseConfig,
    SybaseConnectionParams,
    SybaseConnectionPool,
    SybaseDriver,
    SybaseDriverFeatures,
    SybaseExceptionHandler,
    SybasePoolParams,
    SybaseSyncDataDictionary,
    SybaseSyncMigrationTracker,
)

Synchronous SAP Adaptive Server Enterprise (Sybase ASE) 16.0+ adapter built on pymssql over FreeTDS TDS 5.0 wire protocol. Inherited execution methods are documented on SyncDriverAdapterBase. See the Sybase ASE Setup Guide for TDS 5.0 protocol negotiation and connection pooling, and the Sybase Data Dictionary & SQL Catalog for system catalog introspection queries.

Configuration & Parameters

SybaseConfig

Bases: SyncDatabaseConfig[SybaseConnection, SybaseConnectionPool, SybaseDriver]

Configuration for Sybase ASE synchronous connections over pymssql (FreeTDS TDS 5.0).

SybaseConnectionParams

Bases: TypedDict

Sybase ASE connection parameters.

Attributes:

Name Type Description
server NotRequired[str]

Database server host, IP, or FreeTDS server definition name.

host NotRequired[str]

Alias for server.

freetds_server NotRequired[str]

FreeTDS server configuration section name; requires an explicit port.

server_alias NotRequired[str]

FreeTDS server configuration section name; requires an explicit port.

is_server_alias NotRequired[bool]

Treat server as a FreeTDS configuration section name; requires an explicit port.

user NotRequired[str]

Login user name.

username NotRequired[str]

Alias for user.

password NotRequired[str]

Authentication password.

database NotRequired[str]

Initial database name to connect to.

db NotRequired[str]

Alias for database.

port NotRequired[int | str]

TCP port number; required for section aliases, otherwise defaults to 5000.

timeout NotRequired[SybaseTimeout]

Query execution timeout in seconds.

login_timeout NotRequired[SybaseTimeout]

Login and connection timeout in seconds.

charset NotRequired[str]

Client character set encoding.

as_dict NotRequired[bool]

Return query result rows as dictionaries.

appname NotRequired[str]

Application name sent to the server for connection identification.

conn_properties NotRequired[str]

Session initialization SQL; replaces the default connection properties when supplied.

autocommit NotRequired[bool]

Enable autocommit mode for transactions.

tds_version NotRequired[str]

TDS protocol version (such as '5.0' or '7.4').

encryption NotRequired[Literal['off', 'request', 'require']]

TDS connection encryption level.

arraysize NotRequired[int]

Default cursor fetch array size.

conv NotRequired[Mapping[int | type[Any], Callable[..., Any]]]

Custom datatype conversion dictionary mapping TDS types to python types.

read_only NotRequired[bool]

Native pymssql login intent; does not enforce ASE read-only permissions.

pool_recycle_seconds NotRequired[int]

Maximum age in seconds before a pooled connection is recycled.

health_check_interval NotRequired[float]

Idle duration in seconds before a connection is checked on checkout.

extra NotRequired[dict[str, Any]]

Additional driver connection arguments.

SybasePoolParams

Bases: SybaseConnectionParams

Sybase ASE pool parameters.

SybaseDriverFeatures

Bases: TypedDict

Sybase ASE 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[[SybaseConnection], None]]

Callback invoked immediately when a new connection is established.

enable_events NotRequired[bool]

Enable database event listening.

events_backend NotRequired[Literal['poll_queue']]

Backend mechanism used for dispatching events.

Driver, Pool & Data Dictionary

SybaseDriver

Bases: SyncDriverAdapterBase

Sybase Adaptive Server Enterprise database driver using pymssql over FreeTDS TDS 5.0.

SybaseExceptionHandler

Bases: BaseSyncExceptionHandler

Context manager for handling Sybase pymssql exceptions.

SybaseConnectionPool

Thread-local connection manager for Sybase ASE over pymssql (FreeTDS TDS 5.0).

SybaseSyncDataDictionary

Bases: SyncDataDictionaryBase

Sybase ASE sync data dictionary for metadata reflection.

SybaseSyncMigrationTracker

Bases: SybaseMigrationTrackerMixin, SyncMigrationTracker

Sybase ASE sync migration tracker.

Extension Stores & Configs

SybaseStore

Bases: BaseSQLSpecStore['SybaseConfig']

Sybase ASE-backed session store using pymssql sync sessions.

SybaseADKStore

Bases: BaseSyncADKStore['SybaseConfig']

Synchronous Sybase ASE ADK session/event store.

SybaseADKMemoryStore

Bases: BaseSyncADKMemoryStore['SybaseConfig']

Sybase ASE ADK memory store using pymssql.

SybaseEventQueueStore

Bases: BaseEventQueueStore[SybaseConfig]

Sybase ASE DDL hooks for the event queue store.