Skip to content

Instantly share code, notes, and snippets.

@martinyung
Last active January 29, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save martinyung/ba32885122a252e83439b0ccb65c858b to your computer and use it in GitHub Desktop.
Save martinyung/ba32885122a252e83439b0ccb65c858b to your computer and use it in GitHub Desktop.
python etl
from variables import datawarehouse_name
# sql-server (target db, datawarehouse)
datawarehouse_db_config = {
'Trusted_Connection': 'yes',
'driver': '{SQL Server}',
'server': 'datawarehouse_sql_server',
'database': '{}'.format(datawarehouse_name),
'user': 'your_db_username',
'password': 'your_db_password',
'autocommit': True,
}
# sql-server (source db)
sqlserver_db_config = [
{
'Trusted_Connection': 'yes',
'driver': '{SQL Server}',
'server': 'your_sql_server',
'database': 'db1',
'user': 'your_db_username',
'password': 'your_db_password',
'autocommit': True,
}
]
# mysql
mysql_db_config = [
{
'user': 'your_user_1',
'password': 'your_password_1',
'host': 'db_connection_string_1',
'database': 'db_1',
},
{
'user': 'your_user_2',
'password': 'your_password_2',
'host': 'db_connection_string_2',
'database': 'db_2',
},
]
# firebird
fdb_db_config = [
{
'dsn': "/your/path/to/source.db",
'user': "your_username",
'password': "your_password",
}
]
@greg-amato
Copy link

Cool share on Codeburst!!

Copying as a template and noticed missing commas on line 8 and 20. Cheers!

@sbiswas19
Copy link

Can you please tell me the contents in the module "datawarehouse_name".
The one which you imported.

@martinyung
Copy link
Author

thanks @greg-amato, i have updated it.
@sbiswas19 you can refer to my blog post to get the full picture. https://codeburst.io/using-python-script-for-data-etl-53138c567906

@sbiswas19
Copy link

Thanks @martinyung

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment