-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
71 lines (67 loc) · 2.06 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
import getpass
import subprocess
from sqlmesh.core.config import (
Config,
ModelDefaultsConfig,
GatewayConfig,
DuckDBConnectionConfig,
NameInferenceConfig,
CategorizerConfig,
PlanConfig,
AutoCategorizationMode
)
from sqlmesh.core.user import User, UserRole
from sqlmesh.integrations.github.cicd.config import GithubCICDBotConfig, MergeMethod
def get_current_branch():
try:
branch_name = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip().decode('utf-8')
return branch_name
except Exception as e:
print(f"Error getting current branch: {e}")
return None
current_user = getpass.getuser()
branch = get_current_branch() or 'dev'
default_environment = f"{current_user}__{branch}".replace('-', '_')
print(f"Environment is set to: {default_environment}.")
config = Config(
project="arcane-insight",
default_target_environment=default_environment,
gateways={
"local": GatewayConfig(
connection=DuckDBConnectionConfig(
catalogs={
"bronze": "./data/bronze.duckdb",
"silver": "./data/silver.duckdb",
"gold": "./data/gold.duckdb"
}
)
)
},
default_gateway="local",
model_defaults=ModelDefaultsConfig(
dialect="duckdb,normalization_strategy=case_sensitive",
start="2024-11-01",
cron="*/5 * * * *"
),
model_naming=NameInferenceConfig(
infer_names=True
),
plan=PlanConfig(
auto_categorize_changes=CategorizerConfig(
external=AutoCategorizationMode.FULL,
python=AutoCategorizationMode.FULL,
sql=AutoCategorizationMode.FULL,
seed=AutoCategorizationMode.FULL
)
),
cicd_bot=GithubCICDBotConfig(
merge_method=MergeMethod.MERGE
),
users=[
User(
username="mattiasthalen",
github_username="mattiasthalen",
roles=[UserRole.REQUIRED_APPROVER],
)
]
)