Skip to content

Commit

Permalink
Check the dataset/table exist at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Dec 12, 2023
1 parent eeaadf5 commit 7279cc0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ func getBigQueryTableInserter(cfg config.BigQueryConfig) (*bigquery.Inserter, er
}

dataset := client.Dataset(cfg.Dataset)
_, err = dataset.Metadata(context.Background())
if err != nil {
return nil, err
}

table := dataset.Table(cfg.Table)
_, err = table.Metadata(context.Background())
if err != nil {
return nil, err
}

return table.Inserter(), nil
}

Expand Down

0 comments on commit 7279cc0

Please sign in to comment.