viant / bigquery

BigQuery database/sql golang driver
Apache License 2.0
8 stars 3 forks source link

Support for temporary tables #6

Open Tang8330 opened 1 year ago

Tang8330 commented 1 year ago

I'm unable to create a temporary table using SQL.

See logs:

CREATE TEMP TABLE IF NOT EXISTS _SESSION.customers_customers_custom_snapshot_foo (id int)
WARN[0011] Failed to execute merge...not going to flush memory  error="failed to create temp table, error: failed to run job: artie-labs.job_Fidyw28jRgs4CRXmHFQS87VP4YNl, Use of CREATE TEMPORARY TABLE requires a script or session: [{\"message\":\"Use of CREATE TEMPORARY TABLE requires a script or session\",\"reason\":\"invalid\"}]" tableName=customers_custom_snapshot
INFO[0011] Flushing via pool...                          error="<nil>"

Temporary tables: https://cloud.google.com/bigquery/docs/multi-statement-queries#create_temporary_table

Tang8330 commented 1 year ago

I worked around this issue by just creating a normal table and setting a TTL on it. Not sure why temp tables aren't working though.