Closed
Description
see original issue here: googleapis/python-bigquery-sqlalchemy#74
I'm a committer in Apache Superset and we integrate generally fairly well with BigQuery using the DBAPI driver provided here. Using the python DBAPI driver for BigQuery, we're having an issue running a chain of statements that depend on each other in a common session. I'm using a simple connection and cursor behind the scene.
It appears that the statements are not chained and the session/connection isn't persisted. Any clue on how to solve this? All other DBAPI
Other DBAPI implementations allow this type of chaining, and using the same logic with this driver does not work properly.
Here's a simple script exemplifying this:
DECLARE d DATE DEFAULT CURRENT_DATE();
CREATE TEMP FUNCTION Add(x INT64, y INT64) AS (x + y);
SELECT Add(3, 4);
Environment details
- OS type and version: Linux
- Python version: 3.7.x
- pip version:
20.2.4
google-cloud-bigquery
version:pip show google-cloud-bigquery
1.28.0
Steps to reproduce
code:
with closing(engine.raw_connection()) as conn:
with closing(conn.cursor()) as cursor:
cursor.execute("DECLARE d DATE DEFAULT CURRENT_DATE()")
cursor.execute("CREATE TEMP FUNCTION Add(x INT64, y INT64) AS (x + y)")
cursor.execute("SELECT Add(3, 4)")