Skip to content

sqlanywhere Adapter

from sqlspec.adapters.sqlanywhere import (
    SqlanywhereConfig,
    SqlanywhereConnectionParams,
    SqlanywhereConnectionPool,
    SqlanywhereDriver,
    SqlanywhereDriverFeatures,
    SqlanywhereExceptionHandler,
    SqlanywherePoolParams,
    SqlanywhereSyncDataDictionary,
    SqlanywhereSyncMigrationTracker,
)

Synchronous SAP SQL Anywhere 12+ adapter built on sqlanydb (dbcapi C library). Inherited execution methods are documented on SyncDriverAdapterBase. See the SAP SQL Anywhere Setup Guide for engine connection parameters and pooling, and the SQL Anywhere Data Dictionary & SQL Catalog for system catalog introspection queries.

Configuration & Parameters

SqlanywhereConfig

Bases: SyncDatabaseConfig[SqlanywhereConnection, SqlanywhereConnectionPool, SqlanywhereDriver]

Configuration for SAP SQL Anywhere synchronous connections over sqlanydb.

SqlanywhereConnectionParams

Bases: TypedDict

SAP SQL Anywhere connection parameters.

Attributes:

Name Type Description
nodetype NotRequired[str]

SQL Anywhere mirror node role, including READONLY.

uid NotRequired[str]

User ID / login name for authentication.

user NotRequired[str]

Alias for uid.

username NotRequired[str]

Alias for uid.

pwd NotRequired[str]

Password for authentication.

password NotRequired[str]

Alias for pwd.

dbn NotRequired[str]

Database name on the SQL Anywhere server.

database NotRequired[str]

Alias for dbn.

db NotRequired[str]

Alias for dbn.

eng NotRequired[str]

SQL Anywhere database engine name.

server NotRequired[str]

Alias for eng.

engine NotRequired[str]

Alias for eng.

server_name NotRequired[str]

Alias for eng.

dbf NotRequired[str]

Database file path for local or embedded engines.

database_file NotRequired[str]

Alias for dbf.

host NotRequired[str]

TCP hostname or IP address of the server.

port NotRequired[int | str]

TCP port number of the server.

dsn NotRequired[str]

ODBC data source name.

links NotRequired[str]

Network communications links protocol configuration.

cset NotRequired[str]

Character set used for character data conversion.

extra NotRequired[dict[str, Any]]

Additional connection parameters passed to the driver.

SqlanywherePoolParams

Bases: SqlanywhereConnectionParams

SAP SQL Anywhere 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.

SqlanywhereDriverFeatures

Bases: TypedDict

SAP SQL Anywhere 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[[SqlanywhereConnection], 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

SqlanywhereDriver

Bases: SyncDriverAdapterBase

SAP SQL Anywhere database driver using sqlanydb.

SqlanywhereExceptionHandler

Bases: BaseSyncExceptionHandler

Context manager for handling SAP SQL Anywhere sqlanydb exceptions.

SqlanywhereConnectionPool

Thread-local connection manager for SAP SQL Anywhere over sqlanydb.

SqlanywhereSyncDataDictionary

Bases: SyncDataDictionaryBase

Synchronous SAP SQL Anywhere data dictionary.

SqlanywhereSyncMigrationTracker

Bases: SqlanywhereMigrationTrackerMixin, SyncMigrationTracker

Sync migration tracker using SAP SQL Anywhere DDL.

Extension Stores & Configs

SqlanywhereStore

Bases: BaseSQLSpecStore['SqlanywhereConfig']

SAP SQL Anywhere-backed session store using sqlanydb sync sessions.

SqlanywhereADKStore

Bases: BaseSyncADKStore['SqlanywhereConfig']

Synchronous SAP SQL Anywhere ADK session/event store.

SqlanywhereADKMemoryStore

Bases: BaseSyncADKMemoryStore['SqlanywhereConfig']

SAP SQL Anywhere ADK memory store using sqlanydb.

SqlanywhereEventQueueStore

Bases: BaseEventQueueStore[SqlanywhereConfig]

SAP SQL Anywhere DDL hooks for the event queue store.