-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathChapter9.py
44 lines (35 loc) · 1.44 KB
/
Chapter9.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
#!/usr/bin/env python
# coding: utf-8
from google.cloud import enterpriseknowledgegraph as ekg
project_id = '<your_project>'
dataset_id = 'Chapter9'
client = ekg.EnterpriseKnowledgeGraphServiceClient()
parent = client.common_location_path(project=project_id, location='global')
input_config = ekg.InputConfig(
bigquery_input_configs=[
ekg.BigQueryInputConfig(
bigquery_table=client.table_path(
project=project_id, dataset=dataset_id, table='mari'
),
gcs_uri='gs://<your_bucket>/handsonentityresolution/Chapter9SchemaMari',
),
ekg.BigQueryInputConfig(
bigquery_table=client.table_path(
project=project_id, dataset=dataset_id, table='basic'
),
gcs_uri='gs://<your_bucket>/handsonentityresolution/Chapter9SchemaBasic',
)
],
entity_type=ekg.InputConfig.EntityType.ORGANIZATION,
)
output_config = ekg.OutputConfig(
bigquery_dataset=client.dataset_path(project=project_id, dataset=dataset_id)
)
entity_reconciliation_job = ekg.EntityReconciliationJob(
input_config=input_config, output_config=output_config
)
request = ekg.CreateEntityReconciliationJobRequest(
parent=parent, entity_reconciliation_job=entity_reconciliation_job
)
response = client.create_entity_reconciliation_job(request=request)
print(f"Job: {response.name}")