A datetime.datetime parameter without timezone information uses
the 'DATETIME' BigQuery type (example: Global Pi Day Celebration
March 14, 2017 at 1:59pm). A datetime.datetime parameter with
timezone information uses the 'TIMESTAMP' BigQuery type (example:
a wedding on April 29, 2011 at 11am, British Summer Time).
For more information about BigQuery data types, see:
https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types
`STRUCT`/`RECORD` and `REPEATED` query parameters are not
yet supported. See:
https://github.com/GoogleCloudPlatform/google-cloud-python/issues/3524
Parameters
Name
Description
operation
str
A Google BigQuery query string.
parameters
Union[Mapping[str, Any], Sequence[Any]]
(Optional) dictionary or sequence of parameter values.
job_id
str None
(Optional and discouraged) The job ID to use when creating the query job. For best performance and reliability, manually setting a job ID is discouraged.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class Cursor (3.36.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.36.0 (latest)](/python/docs/reference/bigquery/latest/google.cloud.bigquery.dbapi.Cursor)\n- [3.35.1](/python/docs/reference/bigquery/3.35.1/google.cloud.bigquery.dbapi.Cursor)\n- [3.34.0](/python/docs/reference/bigquery/3.34.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.33.0](/python/docs/reference/bigquery/3.33.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.31.0](/python/docs/reference/bigquery/3.31.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.30.0](/python/docs/reference/bigquery/3.30.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.29.0](/python/docs/reference/bigquery/3.29.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.27.0](/python/docs/reference/bigquery/3.27.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.26.0](/python/docs/reference/bigquery/3.26.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.25.0](/python/docs/reference/bigquery/3.25.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.24.0](/python/docs/reference/bigquery/3.24.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.23.1](/python/docs/reference/bigquery/3.23.1/google.cloud.bigquery.dbapi.Cursor)\n- [3.22.0](/python/docs/reference/bigquery/3.22.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.21.0](/python/docs/reference/bigquery/3.21.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.20.1](/python/docs/reference/bigquery/3.20.1/google.cloud.bigquery.dbapi.Cursor)\n- [3.19.0](/python/docs/reference/bigquery/3.19.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.18.0](/python/docs/reference/bigquery/3.18.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.17.2](/python/docs/reference/bigquery/3.17.2/google.cloud.bigquery.dbapi.Cursor)\n- [3.16.0](/python/docs/reference/bigquery/3.16.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.15.0](/python/docs/reference/bigquery/3.15.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.14.1](/python/docs/reference/bigquery/3.14.1/google.cloud.bigquery.dbapi.Cursor)\n- [3.13.0](/python/docs/reference/bigquery/3.13.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.12.0](/python/docs/reference/bigquery/3.12.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.11.4](/python/docs/reference/bigquery/3.11.4/google.cloud.bigquery.dbapi.Cursor)\n- [3.4.0](/python/docs/reference/bigquery/3.4.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.3.6](/python/docs/reference/bigquery/3.3.6/google.cloud.bigquery.dbapi.Cursor)\n- [3.2.0](/python/docs/reference/bigquery/3.2.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.1.0](/python/docs/reference/bigquery/3.1.0/google.cloud.bigquery.dbapi.Cursor)\n- [3.0.1](/python/docs/reference/bigquery/3.0.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.34.4](/python/docs/reference/bigquery/2.34.4/google.cloud.bigquery.dbapi.Cursor)\n- [2.33.0](/python/docs/reference/bigquery/2.33.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.32.0](/python/docs/reference/bigquery/2.32.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.31.0](/python/docs/reference/bigquery/2.31.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.30.1](/python/docs/reference/bigquery/2.30.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.29.0](/python/docs/reference/bigquery/2.29.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.28.1](/python/docs/reference/bigquery/2.28.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.27.1](/python/docs/reference/bigquery/2.27.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.26.0](/python/docs/reference/bigquery/2.26.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.25.2](/python/docs/reference/bigquery/2.25.2/google.cloud.bigquery.dbapi.Cursor)\n- [2.24.1](/python/docs/reference/bigquery/2.24.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.23.3](/python/docs/reference/bigquery/2.23.3/google.cloud.bigquery.dbapi.Cursor)\n- [2.22.1](/python/docs/reference/bigquery/2.22.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.21.0](/python/docs/reference/bigquery/2.21.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.20.0](/python/docs/reference/bigquery/2.20.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.19.0](/python/docs/reference/bigquery/2.19.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.18.0](/python/docs/reference/bigquery/2.18.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.17.0](/python/docs/reference/bigquery/2.17.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.16.1](/python/docs/reference/bigquery/2.16.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.15.0](/python/docs/reference/bigquery/2.15.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.14.0](/python/docs/reference/bigquery/2.14.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.13.1](/python/docs/reference/bigquery/2.13.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.12.0](/python/docs/reference/bigquery/2.12.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.11.0](/python/docs/reference/bigquery/2.11.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.10.0](/python/docs/reference/bigquery/2.10.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.9.0](/python/docs/reference/bigquery/2.9.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.8.0](/python/docs/reference/bigquery/2.8.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.7.0](/python/docs/reference/bigquery/2.7.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.6.2](/python/docs/reference/bigquery/2.6.2/google.cloud.bigquery.dbapi.Cursor)\n- [2.5.0](/python/docs/reference/bigquery/2.5.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.4.0](/python/docs/reference/bigquery/2.4.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.3.1](/python/docs/reference/bigquery/2.3.1/google.cloud.bigquery.dbapi.Cursor)\n- [2.2.0](/python/docs/reference/bigquery/2.2.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.1.0](/python/docs/reference/bigquery/2.1.0/google.cloud.bigquery.dbapi.Cursor)\n- [2.0.0](/python/docs/reference/bigquery/2.0.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.28.2](/python/docs/reference/bigquery/1.28.2/google.cloud.bigquery.dbapi.Cursor)\n- [1.27.2](/python/docs/reference/bigquery/1.27.2/google.cloud.bigquery.dbapi.Cursor)\n- [1.26.1](/python/docs/reference/bigquery/1.26.1/google.cloud.bigquery.dbapi.Cursor)\n- [1.25.0](/python/docs/reference/bigquery/1.25.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.24.0](/python/docs/reference/bigquery/1.24.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.23.1](/python/docs/reference/bigquery/1.23.1/google.cloud.bigquery.dbapi.Cursor)\n- [1.22.0](/python/docs/reference/bigquery/1.22.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.21.0](/python/docs/reference/bigquery/1.21.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.20.0](/python/docs/reference/bigquery/1.20.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.19.0](/python/docs/reference/bigquery/1.19.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.18.0](/python/docs/reference/bigquery/1.18.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.17.0](/python/docs/reference/bigquery/1.17.0/google.cloud.bigquery.dbapi.Cursor)\n- [1.16.0](/python/docs/reference/bigquery/1.16.0/google.cloud.bigquery.dbapi.Cursor) \n\n Cursor(connection)\n\nDB-API Cursor to Google BigQuery.\n\nProperties\n----------\n\n### query_job\n\n\u003cbr /\u003e\n\n[google.cloud.bigquery.job](/python/docs/reference/bigquery/latest/google.cloud.bigquery.job).query.QueryJob \\| None: The query job\ncreated by the last `execute`*()* call, if a query job was created.\n| **Note:** If the last `execute()` call was `executemany()`, this is the last job created by `executemany()`.\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### close\n\n close()\n\nMark the cursor as closed, preventing its further use.\n\n### execute\n\n execute(operation, parameters=None, job_id=None, job_config=None)\n\nPrepare and execute a database operation.\n\n\u003cbr /\u003e\n\n| **Note:** When setting query parameters, values which are \"text\" (`unicode` in Python2, `str` in Python3) will use the 'STRING' BigQuery type. Values which are \"bytes\" (`str` in Python2, `bytes` in Python3), will use using the 'BYTES' type.\nA `datetime.datetime` parameter without timezone information uses the 'DATETIME' BigQuery type (example: Global Pi Day Celebration March 14, 2017 at 1:59pm). A `datetime.datetime` parameter with timezone information uses the 'TIMESTAMP' BigQuery type (example: a wedding on April 29, 2011 at 11am, British Summer Time).\n\n\u003cbr /\u003e\n\n For more information about BigQuery data types, see:\n https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types\n\n `STRUCT`/`RECORD` and `REPEATED` query parameters are not\n yet supported. See:\n https://github.com/GoogleCloudPlatform/google-cloud-python/issues/3524\n\n### executemany\n\n executemany(operation, seq_of_parameters)\n\nPrepare and execute a database operation multiple times.\n\n### fetchall\n\n fetchall()\n\nFetch all remaining results from the last `execute*()` call.\n| **Note:** If a dry run query was executed, no rows are returned.\n\n### fetchmany\n\n fetchmany(size=None)\n\nFetch multiple results from the last `execute*()` call.\n| **Note:** If a dry run query was executed, no rows are returned.\n| **Note:** The size parameter is not used for the request/response size. Set the `arraysize` attribute before calling `execute()` to set the batch size.\n\n### fetchone\n\n fetchone()\n\nFetch a single row from the results of the last `execute*()` call.\n| **Note:** If a dry run query was executed, no rows are returned.\n\n### setinputsizes\n\n setinputsizes(sizes)\n\nNo-op, but for consistency raise an error if cursor is closed.\n\n### setoutputsize\n\n setoutputsize(size, column=None)\n\nNo-op, but for consistency raise an error if cursor is closed."]]