Configuration file reference¶
Semolina reads connection settings from a TOML file, by default
.semolina.toml in the current directory.
File location¶
create_engine() looks for .semolina.toml in the
working directory. Pass a different path with the config_path argument:
from semolina import create_engine
engine = create_engine(
"default", config_path="config/warehouse.toml"
)
File structure¶
Each named connection lives under [connections.<name>]. The type field
is required and determines which backend fields are available.
[connections.default]
type = "snowflake"
account = "xy12345.us-east-1"
user = "alice"
password = "s3cret"
database = "ANALYTICS"
warehouse = "COMPUTE_WH"
[connections.analytics]
type = "databricks"
host = "adb-123456.azuredatabricks.net"
http_path = "/sql/1.0/warehouses/abc123"
token = "dapi..."
catalog = "main"
[connections.local]
type = "duckdb"
database = "/data/analytics.db"
Use create_engine("analytics") to select a connection by name; the default
is "default".
Common fields¶
These fields are accepted by all connection types:
typestring, requiredBackend identifier. One of
"snowflake","databricks", or"duckdb".pool_sizeinteger, default 5Number of connections to keep in the pool.
max_overflowinteger, default 3Extra connections allowed beyond
pool_sizeunder load.timeoutinteger, default 30Seconds to wait for a connection from the pool before raising.
recycleinteger, default 3600Seconds after which a connection is recycled (closed and replaced).
accountstringSnowflake account identifier (e.g.
xy12345.us-east-1).userstringUsername.
passwordstringPassword for basic authentication.
databasestringDefault database.
schemastringDefault schema.
warehousestringSnowflake virtual warehouse.
rolestringSnowflake role.
regionstringSnowflake region, if not embedded in the account identifier.
hoststringExplicit hostname (alternative to account-derived URI).
portintegerConnection port.
protocolstring"http"or"https".
Authentication
auth_typestringAuthentication method. One of
auth_jwt,auth_ext_browser,auth_oauth,auth_mfa,auth_okta,auth_pat,auth_wif. Omit for basic (user/password) authentication.private_key_pathstringFile path to a PKCS1 or PKCS8 private key. Mutually exclusive with
private_key_pem.private_key_pemstringInline PEM-encoded PKCS8 private key. Mutually exclusive with
private_key_path.private_key_passphrasestringPassphrase to decrypt an encrypted PKCS8 key.
jwt_expire_timeoutstringJWT expiry duration (e.g.
"300ms","1m30s").oauth_tokenstringBearer token for
auth_oauth.okta_urlstringOkta server URL, required when
auth_type = "auth_okta".identity_providerstringIdentity provider for
auth_wif.
Timeouts and behaviour
login_timeoutstringLogin retry timeout duration.
request_timeoutstringRequest retry timeout duration.
client_timeoutstringNetwork roundtrip timeout duration.
tls_skip_verifyboolean, default falseDisable TLS certificate verification.
ocsp_fail_open_modeboolean, default trueAllow connection when OCSP check fails.
keep_session_aliveboolean, default falsePrevent session expiry during long operations.
app_namestringApplication identifier sent to Snowflake.
disable_telemetryboolean, default falseDisable Snowflake usage telemetry.
cache_mfa_tokenboolean, default falseCache MFA token for subsequent connections.
store_temp_credsboolean, default falseCache ID token for SSO.
Databricks connections can be configured in two ways: a full URI, or decomposed fields. Use one or the other, not both.
URI mode
uristringFull connection string:
databricks://token:<token>@<host>:443/<http-path>.
Decomposed mode
hoststringWorkspace hostname (e.g.
adb-123456.azuredatabricks.net).http_pathstringSQL warehouse HTTP path (e.g.
/sql/1.0/warehouses/abc123).tokenstringPersonal access token.
Common fields
catalogstringDefault Unity Catalog.
schemastringDefault schema.
OAuth authentication
auth_typestringOAuth auth type. One of
"OAuthU2M"(browser-based) or"OAuthM2M"(service principal). Omit for PAT authentication.client_idstringOAuth M2M service principal client ID.
client_secretstringOAuth M2M service principal client secret.
databasestring, default “:memory:”Path to a DuckDB database file, or
":memory:"for an in-memory database.read_onlyboolean, default falseOpen the database in read-only mode.
Note
DuckDB enforces pool_size=1 for in-memory databases. Setting
pool_size > 1 with database = ":memory:" raises a
ValidationError. Use a file path for concurrent connections.
See also¶
Installation – set up your first
.semolina.tomlHow to choose and configure a backend – choose and configure a backend
How to connect to DuckDB – DuckDB connection setup
How to connect an engine to your warehouse – build an engine and tune its pool
create_engine()– API reference