Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nil check in get call for gcp_bigquery_table table. closes #324 #329

Merged
merged 3 commits into from
Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions gcp/table_gcp_bigquery_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,11 @@ func getBigqueryTable(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrat
datasetID = d.KeyColumnQuals["dataset_id"].GetStringValue()
id = d.KeyColumnQuals["table_id"].GetStringValue()
}

// Empty Check
if id == "" || datasetID == ""{
return nil, nil
}

resp, err := service.Tables.Get(project, datasetID, id).Do()
if err != nil {
Expand All @@ -314,7 +319,7 @@ func getBigqueryTable(ctx context.Context, d *plugin.QueryData, h *plugin.Hydrat

//// TRANSFORM FUNCTIONS

func bigqueryTableAkas(ctx context.Context, h *transform.TransformData) (interface{}, error) {
func bigqueryTableAkas(_ context.Context, h *transform.TransformData) (interface{}, error) {
data := tableID(h.HydrateItem)

projectID := strings.Split(data, ":")[0]
Expand All @@ -326,7 +331,7 @@ func bigqueryTableAkas(ctx context.Context, h *transform.TransformData) (interfa
return akas, nil
}

func bigQueryTableTitle(ctx context.Context, h *transform.TransformData) (interface{}, error) {
func bigQueryTableTitle(_ context.Context, h *transform.TransformData) (interface{}, error) {
data := tableID(h.HydrateItem)
name := tableName(h.HydrateItem)

Expand Down