Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
fix: fix bug after recipe revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
chuang8511 committed Jun 19, 2024
1 parent 71fa8fe commit 3f82148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions data/bigquery/v0/config/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"type": "object"
}
},
"required": [
"data"
],
"required": [],
"title": "Input",
"type": "object"
},
Expand Down
9 changes: 5 additions & 4 deletions data/bigquery/v0/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,18 @@ func (c *component) GetDefinition(sysVars map[string]any, compConfig *base.Compo
return nil, err
}

if sysVars == nil && compConfig == nil {
if compConfig == nil {
return oriDef, nil
}

def := proto.Clone(oriDef).(*pb.ComponentDefinition)
client, err := NewClient(compConfig.Setup["json_key"].(string), compConfig.Setup["project_id"].(string))
client, err := NewClient(compConfig.Setup["json-key"].(string), compConfig.Setup["project-id"].(string))
if err != nil || client == nil {
return nil, fmt.Errorf("error creating BigQuery client: %v", err)
}
defer client.Close()

myDataset := client.Dataset(compConfig.Setup["dataset_id"].(string))
myDataset := client.Dataset(compConfig.Setup["dataset-id"].(string))
tables, err := constructTableColumns(myDataset, ctx, compConfig)
if err != nil {
return nil, err
Expand Down Expand Up @@ -244,7 +244,7 @@ func constructTableColumns(myDataset *bigquery.Dataset, ctx context.Context, com

// TODO: chuang8511, remove table from definition.json and make it dynamic.
// It will be changed before 2024-06-26.
if compConfig.Setup["table_name"].(string) == tableName {
if compConfig.Setup["table-name"].(string) == tableName {
tables = append(tables, TableColumns{TableName: tableName, Columns: columns})
}
}
Expand All @@ -266,6 +266,7 @@ func constructTableProperties(tables []TableColumns) ([]*structpb.Struct, error)
"description": "Column " + column.Name + " of table " + table.TableName,
"instillFormat": getInstillAcceptFormat(column.Type),
"instillUpstreamTypes": instillUpstreamTypes,
"instillAcceptFormats": []string{getInstillAcceptFormat(column.Type)},
"required": []string{},
"type": getInstillAcceptFormat(column.Type),
}
Expand Down

0 comments on commit 3f82148

Please sign in to comment.