4th commit
This commit is contained in:
@@ -1,47 +1,41 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
# import pyarrow
|
||||
import sys
|
||||
import yaml
|
||||
from datetime import date, timedelta
|
||||
|
||||
import polars as pl
|
||||
import yaml
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from sqlalchemy import create_engine, text
|
||||
from sqlalchemy.engine import Engine, URL
|
||||
|
||||
import clickhouse_connect
|
||||
|
||||
from log import log
|
||||
|
||||
|
||||
|
||||
from clickhouse_task.create_table import *
|
||||
from clickhouse_task.delete_task import *
|
||||
from clickhouse_task.load_table import *
|
||||
from db_con.connection import *
|
||||
from mids import *
|
||||
from masters.dimensions import *
|
||||
from masters.bridge import *
|
||||
from kpi.facts import *
|
||||
mids_list=[1,3]
|
||||
|
||||
run_date=date.today()
|
||||
conditions = {
|
||||
"mids": f"MID IN ({','.join(map(str, mids_list))})",
|
||||
|
||||
"j_plan": (
|
||||
f"MONTH(VisitDate) = {run_date.month} "
|
||||
f"AND YEAR(VisitDate) = {run_date.year}"
|
||||
),
|
||||
|
||||
"mapping": (
|
||||
f"CAST(Z.FromDate AS DATE) <= '{run_date}' "
|
||||
f"AND CAST(Z.ToDate AS DATE) >= '{run_date}'"
|
||||
),
|
||||
|
||||
"web": (
|
||||
f"CAST(login_date AS DATE) = '{run_date}'"
|
||||
),
|
||||
|
||||
"none": None,
|
||||
}
|
||||
|
||||
|
||||
with open("tables.yml", "r") as file:
|
||||
config = yaml.safe_load(file)
|
||||
|
||||
for table in config["tables"]:
|
||||
|
||||
table_name=table["name"]
|
||||
table_type=table["type"]
|
||||
operation=table["operation"]
|
||||
print(table_name)
|
||||
print(table_type)
|
||||
print(operation)
|
||||
for table in config["tables"]:
|
||||
|
||||
table_name=table["name"]
|
||||
table_type=table["type"]
|
||||
operation=table["operation"]
|
||||
condition=table["condition"]
|
||||
c = conditions[condition]
|
||||
print(table_name)
|
||||
print(table_type)
|
||||
print(operation)
|
||||
print(c)
|
||||
Reference in New Issue
Block a user