0
votes

How use CREATE EXTERNAL TABLE DDL statement in BigQuery?

Another big datawarehouses solutions like SnowFlake and Hive Based(Presto, AWS Athena...) have it, and its so useful.

1
did you see anywhere mentioning of CREATE EXTERNAL TABLE DDL? I don't think it is available in BigQuery yet. so you might want to make a feature request - issuetracker.google.com/issues/… - Mikhail Berlyant
CREATE EXTERNAL TABLE is released today (10/14/2020), please check this out: cloud.google.com/bigquery/docs/reference/standard-sql/… - Yun Zhang
@MikhailBerlyant, CREATE EXTERNAL TABLE is released today - Yun Zhang
nice ! thank you for update :o) - Mikhail Berlyant
wow, that is impressive list in today's release!!! great job BigQuery Team!! thank you!! - Mikhail Berlyant

1 Answers

2
votes

Update 10/14/2020, CREATE EXTERNAL TABLE is released today.

CREATE EXTERNAL TABLE dataset.table 
OPTIONS (
  format = 'NEWLINE_DELIMITED_JSON',
  uris = ['gs://bucket/*.json']
);

CREATE EXTERNAL TABLE option is not available in BigQuery, but as an alternative you can use BigQuery command-line-interface to achieve this:

Create Table Definition File:

$ bq mkdef --autodetect --source_format=NEWLINE_DELIMITED_JSON "gs://gcp-bucket/*.json" > myschema

Create External Table:

$ bq mk --external_table_definition=myschema bq_dataset.bq_ext_table

Documentation Link:
https://cloud.google.com/bigquery/external-data-sources