dlt.destinations.impl.sqlalchemy.configuration
ManagedEngine Objects
class ManagedEngine()
Thread-safe engine lifecycle with ref-counted connection borrowing.
Owned engines (created from URL) are disposed when the last borrowed connection is returned. External engines are never disposed.
engine
@property
def engine() -> "Engine"
Lazily creates the engine for owned instances, returns external engine otherwise.
borrow_conn
def borrow_conn() -> "Connection"
Borrow a connection from the engine. Must be returned via return_conn.
return_conn
def return_conn(borrowed_conn: "Connection") -> None
Return a borrowed connection. Disposes owned engine when refcount hits 0.
SqlalchemyCredentials Objects
@configspec(init=False)
class SqlalchemyCredentials(ConnectionStringCredentials)
engine_kwargs
Additional keyword arguments passed to sqlalchemy.create_engine
engine_args
DEPRECATED: use engine_kwargs instead
is_memory_database
@staticmethod
def is_memory_database(database: Optional[str],
query: Optional[Dict[str, Any]] = None) -> bool
Detect if the given database/query represent an in-memory SQLite database.
Handles the following forms:
- Classic:
:memory: - URI:
file:<name>?mode=memory&cache=shared&uri=true
NOTE: empty/None database is NOT considered in-memory here because dlt's configuration system resolves it to a default file path.
SqlalchemyClientConfiguration Objects
@configspec
class SqlalchemyClientConfiguration(WithLocalFiles,
DestinationClientDwhConfiguration)
destination_type
type: ignore
credentials
SQLAlchemy connection string
create_unique_indexes
Whether UNIQUE constrains should be created
create_primary_keys
Whether PRIMARY KEY constrains should be created
engine_kwargs
Additional keyword arguments passed to sqlalchemy.create_engine
engine_args
DEPRECATED: use engine_kwargs instead