GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — python-bigquery/docs/dbapi.rst at master · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Expand file tree

/

dbapi.rst

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
50 lines (34 loc) · 1.54 KB
/

dbapi.rst

Copy path

File metadata and controls

50 lines (34 loc) · 1.54 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

DB-API Reference

.. automodule:: google.cloud.bigquery.dbapi
  :members:
  :show-inheritance:


DB-API Query-Parameter Syntax

The BigQuery DB-API uses the qmark parameter style for unnamed/positional parameters and the pyformat parameter style for named parameters.

An example of a query using unnamed parameters:

insert into people (name, income) values (?, ?)

and using named parameters:

insert into people (name, income) values (%(name)s, %(income)s)

Providing explicit type information

BigQuery requires type information for parameters. The BigQuery DB-API can usually determine parameter types for parameters based on provided values. Sometimes, however, types can't be determined (for example when None is passed) or are determined incorrectly (for example when passing a floating-point value to a numeric column).

The BigQuery DB-API provides an extended parameter syntax. For named parameters, a BigQuery type is provided after the name separated by a colon, as in:

insert into people (name, income) values (%(name:string)s, %(income:numeric)s)

For unnamed parameters, use the named syntax with a type, but no name, as in:

insert into people (name, income) values (%(:string)s, %(:numeric)s)

Providing type information is the only way to pass struct data:

cursor.execute(
  "insert into points (point) values (%(:struct<x float64, y float64>)s)",
  [{"x": 10, "y": 20}],
  )
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.