ETL Dinámico reads all database connection parameters from aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/obedc295/proyect_dw/llms.txt
Use this file to discover all available pages before exploring further.
.env file at the project root. The Settings class in src/config/settings.py loads those variables at import time using python-dotenv, assembles raw ODBC connection strings, and encodes them into fully qualified SQLAlchemy URLs. No connection details live anywhere else in the codebase — every layer that needs a database connection receives it through DatabaseClient, which is itself initialized from the two URLs that Settings produces.
How the .env File Works
When any module imports from src.config.settings, Python executes load_dotenv(), which reads the .env file from the current working directory and injects each KEY=VALUE pair into os.environ. The Settings class then calls os.getenv() for each of the six variables and uses Python f-strings to compose two ODBC connection strings — one for the OLTP source and one for the OLAP destination.
Those raw ODBC strings look like this before encoding:
create_engine() expects a URL and not a raw ODBC string, Settings wraps each string with the mssql+pyodbc:///?odbc_connect= scheme and uses urllib.parse.quote_plus() to percent-encode every special character — including the backslash in named instance server names such as ELIEL\SQLEXPRESS.
Environment Variables
The six variables below are the complete configuration surface for ETL Dinámico. All six are required; if any are missing, the corresponding connection string will contain aNone literal and the create_engine() call will fail at connection time.
OLTP Source Variables
The hostname, IP address, or
host\instance name of the SQL Server instance that hosts your source (OLTP) database. For a named instance such as SQL Server Express, use the backslash-separated form: ELIEL\SQLEXPRESS. ETL Dinámico encodes the backslash automatically — do not percent-encode it manually.The name of the source database on the OLTP server. This is the operational/transactional database from which rows will be extracted. The database must already exist; ETL Dinámico does not create databases.
The exact name of the ODBC driver as registered on the host machine. ETL Dinámico requires ODBC Driver 17 for SQL Server. The value must match the driver name exactly as it appears in the ODBC Data Source Administrator (Windows) or
odbcinst.ini (Linux/macOS).OLAP Destination Variables
The hostname, IP address, or
host\instance name of the SQL Server instance that hosts your destination (OLAP / Data Warehouse) database. This can be the same value as OLTP_SERVER if both databases reside on the same instance.The name of the destination database on the OLAP server. This is your Data Warehouse, which must already contain the target dimension and fact tables. ETL Dinámico appends rows into existing tables using
DataFrame.to_sql with if_exists='append'.The exact ODBC driver name for the OLAP destination connection. In almost all cases this will be the same value as
OLTP_DRIVER. Both connections are independent, so they can technically use different driver versions if needed.How Settings Builds SQLAlchemy URLs
The Settings class source code in src/config/settings.py shows the full URL construction process:
.env file:
Trusted_Connection=yes— instructs the ODBC driver to authenticate using the Windows identity of the process running ETL Dinámico. No SQL Server username or password is required.TrustServerCertificate=yes— bypasses SSL certificate validation for the server’s TLS certificate. This is safe for local development and internal network environments but should be evaluated against your organization’s security policy for production deployments.
Windows Authentication (
Trusted_Connection=yes) means the SQL Server login used is the Windows user account running the Python process. Ensure that account has at minimum db_datareader on the OLTP database and db_datawriter + db_ddladmin (or equivalent) on the OLAP database, since DataFrame.to_sql may need to create tables.The Final URL Format
Afterurllib.parse.quote_plus() encodes the raw ODBC string, the final URL passed to create_engine() has this structure:
Settings handles it entirely.
Example: Same Server for OLTP and OLAP
This is the most common configuration for local development, where a single SQL Server Express instance hosts both the source database and the Data Warehouse.OLTP_SERVER and OLAP_SERVER share the same value, DatabaseClient will create two separate SQLAlchemy engines pointing at the same SQL Server instance but different databases. SQLAlchemy manages each engine’s connection pool independently.
Example: Separate Servers for OLTP and OLAP
In a production environment it is common for the operational database and the Data Warehouse to live on separate SQL Server hosts. Simply provide distinct server names for the two groups of variables:Backslashes in Server Names
SQL Server named instances use a backslash in their address — for example,ELIEL\SQLEXPRESS. Backslashes are not valid unescaped characters in URL strings, which is why Settings runs every raw ODBC string through urllib.parse.quote_plus() before passing it to create_engine().
The encoding performed by quote_plus converts \ to %5C in the final URL, which the ODBC driver correctly interprets as a path separator between the host and the instance name.
Verifying Your Configuration
After creating your.env file you can quickly validate that both connections resolve correctly by running a short Python script from the project root:
.env configuration is correct and the ODBC driver is communicating successfully with SQL Server. If you see a pyodbc.OperationalError, double-check the server name, database name, driver name, and that the Windows account running Python has been granted access to both databases.