-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
56 lines (50 loc) · 1.06 KB
/
test.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
import dbtc
JOB_QUERY = """
query Job($jobId: BigInt!, $runId: BigInt, $schema: String) {
job(id: $jobId, runId: $runId) {
models(schema: $schema) {
name
uniqueId
database
access
}
}
}
"""
PUBLIC_MODELS_QUERY = """
query Account($accountId: BigInt!, $filter: PublicModelsFilter) {
account(id: $accountId) {
publicModels(filter: $filter) {
uniqueId
name
dependentProjects {
projectId
defaultEnvironmentId
dependentModelsCount
}
}
}
}
"""
ENVIRONMENT_QUERY = """
query Lineage($environmentId: BigInt!, $filter: AppliedResourcesFilter!) {
environment(id: $environmentId) {
applied {
lineage(filter: $filter) {
uniqueId
name
publicParentIds
}
}
}
}
"""
client = dbtc.dbtCloudClient(
service_token="dbtc_Zx23Z4Yxd2jFYV6ixcRRlvXizT7cv_Qq5k2cgtdYF7Tn63Fj8A"
)
variables = {
"accountId": 43786,
"filter": {"uniqueIds": ["model.upstream.int_segment__pages"]},
}
results = client.metadata.query(PUBLIC_MODELS_QUERY, variables)
results