Skip to main content

bigquery_fdw: BigQuery Foreign Data Wrapper for PostgreSQL

Pypi Build Status codecov MIT licensed

bigquery_fdw is a BigQuery foreign data wrapper for PostgreSQL using Multicorn.

It allows to write queries in PostgreSQL SQL syntax using a foreign table. It supports most of BigQuery's data types and operators.

Features and limitations

Read more.

Requirements

  • PostgreSQL 14 to 18
  • Python >= 3.10

Get started

Using docker

See getting started with Docker

Installation on Debian/Ubuntu

Dependencies required to install bigquery_fdw:

You need to install the following dependencies:

# Install required packages
apt update
apt install -y postgresql-server-dev-18 python3-setuptools python3-dev make gcc git

PostgreSQL versions 14 to 18 are tested in CI.

Installation

# Install Multicorn
# multicorn2 is a fork of Segfault-Inc/Multicorn that adds support for recent PostgreSQL versions.
# The original pgsql-io/multicorn2 repository was removed in October 2026; this copy is pinned to its v3.2 release.
# Alternatively, up to PostgreSQL 12, you can use gabfl/Multicorn that adds better support for Python3.
# You may also choose to build against the original project instead.
git clone https://github.com/ShaheedHaque/multicorn2.git Multicorn && cd Multicorn
git checkout 4e0feaa8c8a4e7db80ff442d71fb7786d5519e29
make && make install

# Install bigquery_fdw
pip3 install bigquery-fdw

Major dependencies installed automatically during the installation process:

Authentication

bigquery_fdw relies on Google Cloud API's default authentication.

Your need to have an environment variable GOOGLE_APPLICATION_CREDENTIALS that has to be accessible by bigquery_fdw. Setting environment variables varies depending on OS but for Ubuntu or Debian, the preferred way is to edit /etc/postgresql/[version]/main/environment and add:

GOOGLE_APPLICATION_CREDENTIALS = '/path/to/key.json'

Restarting PostgreSQL is required for the environment variable to be loaded.

Usage

We recommend testing the BigQuery client connectivity before trying to use the FDW.

With psql:

CREATE EXTENSION multicorn;

CREATE SERVER bigquery_srv FOREIGN DATA WRAPPER multicorn
OPTIONS (
    wrapper 'bigquery_fdw.fdw.ConstantForeignDataWrapper'
);

CREATE FOREIGN TABLE my_bigquery_table (
    column1 text,
    column2 bigint
) SERVER bigquery_srv
OPTIONS (
    fdw_dataset  'my_dataset',
    fdw_table 'my_table'
);

Options

List of options implemented in CREATE FOREIGN TABLE syntax:

Option Default Description
fdw_dataset - BigQuery dataset name
fdw_table - BigQuery table name
fdw_convert_tz - Convert BigQuery time zone for dates and timestamps to selected time zone. Example: 'US/Eastern'.
fdw_group 'false' See Remote grouping and counting.
fdw_casting - See Casting.
fdw_verbose 'false' Set to 'true' to output debug information in PostrgeSQL's logs
fdw_sql_dialect 'standard' BigQuery SQL dialect. Currently only standard is supported.

More documentation

See bigquery_fdw documentation.

Metadata

Release files for bigquery-fdw 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bigquery-fdw 2.2.0
File Size Uploaded Provenance Actions
bigquery_fdw-2.2.0.tar.gz 10.0 kB Without provenance Details for bigquery_fdw-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bigquery-fdw 2.2.0
File Interpreter ABI Platform Actions
bigquery_fdw-2.2.0-py3-none-any.whl Python 3 none any Details for bigquery_fdw-2.2.0-py3-none-any.whl

Total release size: 20.8 kB

Release files / bigquery_fdw-2.2.0.tar.gz

Download URL bigquery_fdw-2.2.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
736bd0ab766dbfcc3aa2d6eb12e4d1940660dd6b0b38ca630d18ba741076e2d3
BLAKE2b-256 checksum
How to use checksums
2c9c823cf18e4cc5df2e3cb7b92c387cbea7e65d7016fd4e15d0cd0e5d55479c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / bigquery_fdw-2.2.0-py3-none-any.whl

Download URL bigquery_fdw-2.2.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
964ceb683b040094093fb55b54046488d4b02dcad07e7e567a62c731f3b0564c
BLAKE2b-256 checksum
How to use checksums
1dade2e9237f7dd40eb5d69468906f108d4f38284295f33c988dd48166d676f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for bigquery-fdw 2.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page