Closed
Description
Is your feature request related to a problem? Please describe.
I would like to store the job_id
that references the job created after cursor.execute
is called. Currently I do this:
job_id = dbapi_cursor._query_job.job_id
Describe the solution you'd like
I would prefer to do something like this:
# Returns the `QueryJob` created by the last `execute*()` call
job = dbapi_cursor.job()
job_id = job.job_id
Describe alternatives you've considered
It is possible to specify the job_id
when calling cursor.execute
, however:
- I don't call
cursor.execute
in my code (see additional context below) - I would prefer to use the generated ID
Additional context
I interact with this library from the BigQuery SQLAlchemy dialect, so I never call DBAPI execute
directly:
sqlalchemy_cursor = engine.execute(...) # eventually calls `dbapi_cursor.execute`
dbapi_cursor = sqlalchemy_cursor.cursor
job_id = dbapi_cursor._query_job.job_id