Skip to content

Commit 2da7bd0

Browse files
committed
refactor(bigquery): prevent error on when partition is nil
1 parent d089df9 commit 2da7bd0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/extractors/bigquery/bigquery.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ func (e *Extractor) extractTable(ctx context.Context, ds *bigquery.Dataset, out
9696

9797
// Build the bigquery table metadata
9898
func (e *Extractor) buildTable(ctx context.Context, t *bigquery.Table, md *bigquery.TableMetadata) assets.Table {
99+
var partitionField string
100+
if md.TimePartitioning != nil {
101+
partitionField = md.TimePartitioning.Field
102+
}
103+
99104
return assets.Table{
100105
Resource: &common.Resource{
101106
Urn: fmt.Sprintf("%s:%s.%s", t.ProjectID, t.DatasetID, t.TableID),
@@ -110,7 +115,7 @@ func (e *Extractor) buildTable(ctx context.Context, t *bigquery.Table, md *bigqu
110115
"dataset": t.DatasetID,
111116
"project": t.ProjectID,
112117
"type": string(md.Type),
113-
"partition_field": md.TimePartitioning.Field,
118+
"partition_field": partitionField,
114119
}),
115120
Labels: md.Labels,
116121
},

0 commit comments

Comments
 (0)