Skip to main content
Version: devel

dlt.destinations.impl.sqlalchemy.configuration

ManagedEngine Objects

class ManagedEngine()

View source on GitHub

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"

View source on GitHub

Lazily creates the engine for owned instances, returns external engine otherwise.

borrow_conn

def borrow_conn() -> "Connection"

View source on GitHub

Borrow a connection from the engine. Must be returned via return_conn.

return_conn

def return_conn(borrowed_conn: "Connection") -> None

View source on GitHub

Return a borrowed connection. Disposes owned engine when refcount hits 0.

SqlalchemyCredentials Objects

@configspec(init=False)
class SqlalchemyCredentials(ConnectionStringCredentials)

View source on GitHub

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

View source on GitHub

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)

View source on GitHub

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

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.