forked from MLakshmi-191203/Dynamic_etl_framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_reader.py
More file actions
43 lines (34 loc) · 985 Bytes
/
Copy pathconfig_reader.py
File metadata and controls
43 lines (34 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from db import get_pg_conn
def get_active_configs():
conn = get_pg_conn()
cur = conn.cursor()
cur.execute("""
SELECT
id,
source_system,
source_database,
source_schema,
source_table,
file_path,
target_system,
target_database,
target_schema,
target_table,
primary_key,
load_type
FROM dyn_etl.process_control
WHERE is_active = true
""")
cols = [desc[0] for desc in cur.description]
configs = []
for row in cur.fetchall():
config = dict(zip(cols, row))
# 🔹 Normalize values (IMPORTANT)
config["source_system"] = config["source_system"].upper()
config["target_system"] = config["target_system"].upper()
configs.append(config)
conn.close()
print("🔍 Active Configs Loaded:")
for c in configs:
print(c)
return configs