Skip to content

Conversation

@tetelio
Copy link
Contributor

@tetelio tetelio commented Dec 2, 2025

Description

dlt users want to pass SQLAlchemy engine arguments for:

  1. SQL sources (sql_database and sql_table)
  2. SQL destination

Summary of Changes

This PR introduces support for configuring SQLAlchemy engine arguments across both sources and destinations, addressing a long-standing usability gap:

  • Sources (sql_database, sql_table)

    • Added a new parameter engine_kwargs, forwarded directly to sqlalchemy.create_engine().
    • Supports configuring reflection behavior and extraction for the SQLAlchemy backend.
    • Includes comprehensive tests:
      • invalid kwargs propagation
      • reflection failure
      • SQLite timeout enforcement
      • interaction with backend_kwargs when using non-SQLAlchemy backends
      • SQLAlchemy echo logging behavior
  • Destination (SQLAlchemy)

    • Adds missing documentation for existing engine_args.
    • Adds tests to verify correct behavior for both in-memory and file-based SQLite destinations using engine_args.
  • Documentation

    • Adds new docs for source-side engine_kwargs.
    • Adds new docs for destination-side engine_args.
    • Clarifies that source and destination engines are separate and configured independently.

Question: To reduce user confusion, should the source parameter be named engine_kwargs (current) or unified as engine_args (matching the destination)?

Related Issues

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 2, 2025

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
docs cbf342d Commit Preview URL

Branch Preview URL
Jan 06 2026, 02:52 PM

Copy link
Collaborator

@rudolfix rudolfix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really good! let's look at existing test fixtures tomorrow

return engine_.connect()

def return_conn(self, borrowed_conn: "Connection") -> None:
if getattr(self, "_conn_owner", None) is False:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like passing external engine here never worked before... we need to test it well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i added that passsing built engine is not disposed after use

engine_kwargs = engine_kwargs or {}
engine = engine_from_credentials(
credentials,
False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to pass may_dispose_after_use here

table_name="inmemory_table"
)

assert_load_info(info)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd check if engine is not disposed after use in the pipeline


def test_engine_kwargs_timeout_is_honored_sqlite():
"""SQLite timeout in engine_kwargs must be honored."""
fd, db_path = tempfile.mkstemp(suffix=".db")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a test storage which is automatically cleared.

@tetelio tetelio self-assigned this Dec 12, 2025
@tetelio tetelio force-pushed the feat/3187-add-engine-args-sqlalchemy-source-and-destination branch from f6bf24a to 3a137ba Compare December 12, 2025 08:59
@tetelio tetelio force-pushed the feat/3187-add-engine-args-sqlalchemy-source-and-destination branch from 5efbc8a to 7dc1520 Compare January 4, 2026 19:56
@tetelio tetelio force-pushed the feat/3187-add-engine-args-sqlalchemy-source-and-destination branch from ed30b66 to d168f45 Compare January 6, 2026 08:44
@tetelio tetelio force-pushed the feat/3187-add-engine-args-sqlalchemy-source-and-destination branch from 3e4243a to cbf342d Compare January 6, 2026 14:45
@tetelio tetelio assigned rudolfix and unassigned tetelio Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing oracle arraysize to sqlalchemy when using sql_database source

3 participants