Reputation: 7940
I am executing CREATE TABLE IF NOT EXIST
via client API using following JobConfigurationQuery
:
queryConfig.setUseLegacySql(false)
queryConfig.setFlattenResults(false)
queryConfig.setQuery(query)
As I am executing CREATE TABLE DDL, I cannot specify destination table, write dispositions, etc. In my Query History section of Web UI, I see job being executed successfully without any exceptions, and with no writes happening. Is DDL statement not supported via client API?
I am using following client: "com.google.apis" % "google-api-services-bigquery" % "v2-rev397-1.23.0"
Upvotes: 1
Views: 690
Reputation: 1587
From BigQuery docs which says it seems that no error is returned when table exists:
The CREATE TABLE IF NOT EXISTS DDL statement creates a table with the specified options only if the table name does not exist in the dataset. If the table name exists in the dataset, no error is returned, and no action is taken.
Answering your question, DDL is supported from API which is also stated in doc, to do this:
Call the jobs.query method and supply the DDL statement in the request body's query property.
Upvotes: 2