Class Cursor (1.18.0)

  Cursor 
 ( 
 connection 
 ) 
 

DB-API Cursor to Google BigQuery.

Parameter

Name Description
connection Connection

A DB-API connection to Google BigQuery.

Inheritance

builtins.object > Cursor

Methods

close

  close 
 () 
 

No-op.

execute

  execute 
 ( 
 operation 
 , 
 parameters 
 = 
 None 
 , 
 job_id 
 = 
 None 
 ) 
 

Prepare and execute a database operation.

.. 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.

 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 Mapping[str, Any] or Sequence[Any]

(Optional) dictionary or sequence of parameter values.

job_id str

(Optional) The job_id to use. If not set, a job ID is generated at random.

executemany

  executemany 
 ( 
 operation 
 , 
 seq_of_parameters 
 ) 
 

Prepare and execute a database operation multiple times.

Parameter
Name Description
operation str

A Google BigQuery query string.

fetchall

  fetchall 
 () 
 

Fetch all remaining results from the last execute*() call.

Exceptions
Type Description
InterfaceError if called before ``execute()``.
Returns
Type Description
List[tuple] A list of all the rows in the results.

fetchmany

  fetchmany 
 ( 
 size 
 = 
 None 
 ) 
 

Fetch multiple results from the last execute*() call.

.. note:: The size parameter is not used for the request/response size. Set the arraysize attribute before calling execute() to set the batch size.

Parameter
Name Description
size int

(Optional) Maximum number of rows to return. Defaults to the arraysize property value.

Exceptions
Type Description
InterfaceError if called before ``execute()``.
Returns
Type Description
List[tuple] A list of rows.

fetchone

  fetchone 
 () 
 

Fetch a single row from the results of the last execute*() call.

Exceptions
Type Description
InterfaceError if called before ``execute()``.
Returns
Type Description
tuple A tuple representing a row or ``None`` if no more data is available.

setinputsizes

  setinputsizes 
 ( 
 sizes 
 ) 
 

No-op.

setoutputsize

  setoutputsize 
 ( 
 size 
 , 
 column 
 = 
 None 
 ) 
 

No-op.

Create a Mobile Website
View Site in Mobile | Classic
Share by: