-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
95 lines (69 loc) · 3.88 KB
/
config.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from pathlib import Path
import logging
##############################################################################
# Common Config #
#############################################################################
LOGGING_LEVEL = logging.INFO
# The CSV File containing a list of UC4 Jobs
UC4_CSV_FILE = Path(Path.cwd(), "input_csvs", "uc4_jobs.csv")
#The csv_file containing the bind variables
BIND_VARIABLE_CSV_FILE = Path(Path.cwd(), "input_csvs", "bind_variables.csv")
# The GCP Project where the metadata will be stored
METADATA_PROJECT = "michael-gilbert-dev"
METADATA_DATASET = "uc4_conversion_metadata"
# The UC4 XML to JSON conversion stores the JSON in a BigQuery table.
# This is its name
UC4_JSON_TABLE = f"{METADATA_PROJECT}.{METADATA_DATASET}.uc4_json"
UC4_SQL_REPO_NAME = "UC4_SQL"
# Repo containing the SQLS to be translated.
UC4_SQL_REPO = {
"path": f"https://github.com/RealistAI/{UC4_SQL_REPO_NAME}.git",
"branch": "master"
}
BASE_PATH = Path(Path.home(), "required_repos")
##############################################################################
# Generate Teradata to BigQuery Mapping Config #
#############################################################################
# The table that stores the Teradata to BigQuery Mapping
TD_TO_BQ_MAPPING_TABLE = \
f"{METADATA_PROJECT}.{METADATA_DATASET}.teradata_to_bigquery_mapping"
# A CSV file containing the mapping between business units and datasets
BUSINESS_UNIT_DATASET_MAP_CSV_FILE = Path(Path.cwd(), "input_csvs",
"business_unit_dataset_map.csv")
##############################################################################
# Translate SQL Config #
#############################################################################
# This is where the Translate SQL will store the dry-run logs.
TRANSLATION_LOG_TABLE = \
f"{METADATA_PROJECT}.{METADATA_DATASET}.translation_log"
# The GCP Project that houses the BQMS Service
BQMS_PROJECT= "michael-gilbert-dev"
# The name of the bucket that the BQMS can use for its transpilaitons
BQMS_GCS_BUCKET = "gs://dwh_preprocessed"
# A setting that determines the default database for tables if one is not
# specified in the SQL
BQMS_DEFAULT_DATABASE = "michael-gilbert-dev"
# Specifies whether or not the BQMS should clean up temp files after running
BQMS_CLEAN_UP_TEMP_FILES = "True"
BQMS_FOLDER = Path(Path.home(), "bqms")
# The directory where the BQMS will look for the SQLs that need to be converted
# NOTE: Everything in this directory will be deleted each time the BQMS is run
BQMS_INPUT_FOLDER = Path(BQMS_FOLDER, "input")
# This is where the BQMS will write the transpilations to
# NOTE: Everything in this directory will be deleted each time the BQMS is run
BQMS_OUTPUT_FOLDER = Path(BQMS_FOLDER, "output")
# This is where the BQMS will look for the configuraitons
# NOTE: Everything in this directory will be deleted each time the BQMS is run
BQMS_CONFIG_FOLDER = Path(BQMS_FOLDER, "config")
# This is the main config file used by the BQMS
BQMS_CONFIG_FILE = Path(BQMS_CONFIG_FOLDER , "config.yaml")
# This file will contain the object mapping created by the Translate SQL script
BQMS_OBJECT_MAPPING_FILE = Path(BQMS_CONFIG_FOLDER , "object_mapping.json")
# The Translate SQL script will parse the UC4 Job JSON to determine which
# SQLs are referenced and, therefore, which SQLS need to be transpiled. This
# is the root directory where the script will look.
# NOTE: The SQL references in the UC4 jobs have the rest of the file path
SOURCE_SQL_PATH = Path(BASE_PATH, UC4_SQL_REPO_NAME, "teradata_sql")
# After successful translaiton and dry-run, the Translate SQL script will copy
# the SQL files back to this directory.
TARGET_SQL_PATH = Path(BASE_PATH, UC4_SQL_REPO_NAME, "bigquery_sql")