-
Notifications
You must be signed in to change notification settings - Fork 0
/
github_pipeline.py
40 lines (35 loc) · 999 Bytes
/
github_pipeline.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
import dlt
import rest_api.typing
from rest_api import rest_api_source
config: rest_api.typing.RESTAPIConfig = {
"client": {
"base_url": "https://api.github.com/repos/dlt-hub/verified-sources",
"auth": {"token": dlt.secrets["sources.github.token"]},
},
"resources": [
{
"name": "issues",
"endpoint": {
"params": {
"creator": "@me",
"since": {
"type": "incremental",
"cursor_path": "updated_at",
"initial_value": "2022-01-01T00:00:00Z",
},
}
},
"write_disposition": "merge",
"primary_key": "id",
}
],
}
source = rest_api_source(config)
pipeline = dlt.pipeline(
pipeline_name="github_pipeline",
destination="duckdb",
dataset_name="github",
progress="log",
)
load_info = pipeline.run(source)
print(load_info)