-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathotf_pipeline.py
More file actions
35 lines (25 loc) · 825 Bytes
/
otf_pipeline.py
File metadata and controls
35 lines (25 loc) · 825 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
import argparse
from dbt.cli.main import dbtRunner
from dlt import pipeline
from helpers.pipeline import otf_source
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--full-refresh", help="fully refresh all data", action="store_true")
args = parser.parse_args()
def load_orange_theory(args=args) -> None:
pipe = pipeline(
pipeline_name="rest_api_orange_theory",
destination="filesystem",
dataset_name="otf_api_data",
)
pipe.run(otf_source(args))
return
def run_dbt(args=args) -> None:
dbt = dbtRunner()
cli_args = ["run", "--project-dir", "duck_dbt", "--profiles-dir", "duck_dbt"]
if args.full_refresh:
cli_args.append("--full-refresh")
dbt.invoke(cli_args)
return
if __name__ == '__main__':
load_orange_theory()
run_dbt()