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.
41 lines
972 B
Python
41 lines
972 B
Python
from connectors.database import DBConfig
|
|
from starlette.config import Config
|
|
import os
|
|
|
|
|
|
def get_config():
|
|
try:
|
|
# Try to load from .env file first
|
|
config = Config(".env")
|
|
except FileNotFoundError:
|
|
# If .env doesn't exist, use environment variables
|
|
config = Config(environ=os.environ)
|
|
|
|
return config
|
|
|
|
|
|
env = get_config()
|
|
|
|
config = {
|
|
'batch_size': 1000,
|
|
'target_table': 'oh_wo_master',
|
|
'columns': ['assetnum', 'worktype', 'workgroup', 'total_cost_max', 'created_at'],
|
|
}
|
|
|
|
target_config = DBConfig(
|
|
host=env("DATABASE_HOSTNAME"),
|
|
port=env("DATABASE_PORT"),
|
|
database=env("DATABASE_NAME"),
|
|
user=env("DATABASE_CREDENTIAL_USER"),
|
|
password=env("DATABASE_CREDENTIAL_PASSWORD")
|
|
)
|
|
|
|
|
|
source_config = DBConfig(
|
|
host=env("COLLECTOR_HOSTNAME"),
|
|
port=env("COLLECTOR_PORT"),
|
|
database=env("COLLECTOR_NAME"),
|
|
user=env("COLLECTOR_CREDENTIAL_USER"),
|
|
password=env("COLLECTOR_CREDENTIAL_PASSWORD")
|
|
)
|