-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support per-database configuration in sql_database
and sql_table
sources
#2114
Comments
@trymzet you should be able to get what you need by giving each source = sql_database(...).with_args(name="my_database", section="my_database") and then [sources.my_database.credentials] you could also tryi
and
https://dlthub.com/docs/api_reference/extract/source#with_args |
@rudolfix it's still looking under db = sql_database(schema="my_schema", backend="pyarrow").with_args(
name="mssql", section="mssql"
) dlt.common.configuration.exceptions.ConfigFieldMissingException: Following fields are missing: ['drivername'] in configuration with spec ConnectionStringCredentials
for field "drivername" config providers and keys were tried in following order:
In Environment Variables key SOURCES__SQL_DATABASE__SQL_DATABASE__CREDENTIALS__DRIVERNAME was not found.
In Environment Variables key SOURCES__SQL_DATABASE__CREDENTIALS__DRIVERNAME was not found.
In Environment Variables key SOURCES__CREDENTIALS__DRIVERNAME was not found.
In Environment Variables key CREDENTIALS__DRIVERNAME was not found.
In secrets.toml key sources.sql_database.sql_database.credentials.drivername was not found.
In secrets.toml key sources.sql_database.credentials.drivername was not found.
In secrets.toml key sources.credentials.drivername was not found.
In secrets.toml key credentials.drivername was not found.
In config.toml key sources.sql_database.sql_database.credentials.drivername was not found.
In config.toml key sources.sql_database.credentials.drivername was not found.
In config.toml key sources.credentials.drivername was not found.
In config.toml key credentials.drivername was not found. Also, is there a way to pass these when using |
@trymzet OK I gave you a wrong example :) as you say - you need to rename the source before it is called. this one works: from dlt.sources import sql_database
renamed = sql_database.sql_database.with_args(name="my_db", section="my_db")(table_names=["table_1"]) in case of standalone |
Feature description
Currently, you must either have one
sql_database
config, or per-pipeline configs. This is impractical if ingesting from multiple databases and having possibly many (eg. if creating a pipeline per table or per schema) pipelines, which AFAIK is a common use case.(BTW I think there's the same issue with eg. the
filesystem
destination, which also only works if you only load data to one filesystem.)Are you a dlt user?
None
Use case
No response
Proposed solution
Would love to be able to do something like
And then in the code you have sth like
Related issues
No response
The text was updated successfully, but these errors were encountered: