Skip to content

Commit fd00133

Browse files
authored
fix(gcp-resources): Add project_id and id as PKs of gcp_bigquery_datasets (#6532)
#### Summary Add missing PK(s) for `gcp_bigquery_datasets`. Non breaking as the data should exist <!--
1 parent 5d87911 commit fd00133

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

plugins/source/gcp/docs/tables/gcp_bigquery_datasets.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#Dataset
44

5-
The primary key for this table is **_cq_id**.
5+
The composite primary key for this table is (**project_id**, **id**).
66

77
## Relations
88

@@ -15,9 +15,10 @@ The following tables depend on gcp_bigquery_datasets:
1515
| ------------- | ------------- |
1616
|_cq_source_name|String|
1717
|_cq_sync_time|Timestamp|
18-
|_cq_id (PK)|UUID|
18+
|_cq_id|UUID|
1919
|_cq_parent_id|UUID|
20-
|project_id|String|
20+
|project_id (PK)|String|
21+
|id (PK)|String|
2122
|access|JSON|
2223
|creation_time|Int|
2324
|dataset_reference|JSON|
@@ -28,7 +29,6 @@ The following tables depend on gcp_bigquery_datasets:
2829
|description|String|
2930
|etag|String|
3031
|friendly_name|String|
31-
|id|String|
3232
|is_case_insensitive|Bool|
3333
|kind|String|
3434
|labels|JSON|

plugins/source/gcp/resources/services/bigquery/datasets.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ func Datasets() *schema.Table {
2020
Name: "project_id",
2121
Type: schema.TypeString,
2222
Resolver: client.ResolveProject,
23+
CreationOptions: schema.ColumnCreationOptions{
24+
PrimaryKey: true,
25+
},
26+
},
27+
{
28+
Name: "id",
29+
Type: schema.TypeString,
30+
Resolver: schema.PathResolver("Id"),
31+
CreationOptions: schema.ColumnCreationOptions{
32+
PrimaryKey: true,
33+
},
2334
},
2435
},
2536
Relations: []*schema.Table{

0 commit comments

Comments
 (0)