Skip to content

Commit

Permalink
Check schema when creating tables in BigQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Apr 6, 2022
1 parent e68bf33 commit f1a05ee
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ private void createTable(ConnectorSession session, ConnectorTableMetadata tableM
SchemaTableName schemaTableName = tableMetadata.getTable();
String schemaName = schemaTableName.getSchemaName();
String tableName = schemaTableName.getTableName();

if (!schemaExists(session, schemaName)) {
throw new SchemaNotFoundException(schemaName);
}

List<Field> fields = tableMetadata.getColumns().stream()
.map(column -> toField(column.getName(), column.getType()))
.collect(toImmutableList());
Expand Down

0 comments on commit f1a05ee

Please sign in to comment.