You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
788 B
Python
30 lines
788 B
Python
import pymysql
|
|
import psycopg2 as psyco
|
|
from dotenv import dotenv_values
|
|
|
|
env_path = "../containers/.env"
|
|
ENV = dotenv_values(env_path)
|
|
|
|
def mariadb_conn(**kwargs):
|
|
return pymysql.connect(
|
|
database=ENV["MYSQL_DB"]
|
|
,user=ENV["MYSQL_USER"]
|
|
,host=ENV["MYSQL_HOST"]
|
|
,port=int(ENV["MYSQL_PORT"])
|
|
,password=ENV["MYSQL_PASSWORD"]
|
|
,**kwargs
|
|
)
|
|
|
|
def postgres_conn(**kwargs):
|
|
return psyco.connect(
|
|
dbname=ENV["POSTGRES_DB"]
|
|
,user=ENV["POSTGRES_USER"]
|
|
,host=ENV["POSTGRES_HOST"]
|
|
,port=ENV["POSTGRES_PORT"]
|
|
,password=ENV["POSTGRES_PASSWORD"]
|
|
,**kwargs
|
|
)
|
|
|
|
|
|
def get_tables_of_interest():
|
|
return ENV["TABLES_OF_INTEREST"].split(",") |