Skip to main content

BigQuery Foreign Data Wrapper for PostgreSQL

Project description

# bigquery_fdw: BigQuery Foreign Data Wrapper for PostgreSQL

bigquery_fdw is a BigQuery foreign data wrapper for PostgreSQL using [Multicorn](https://github.com/Kozea/Multicorn).

It allows to write queries in PostgreSQL SQL syntax using a foreign table. It supports most of BigQuery's [data types](docs/data_types.md) and [operators](docs/operators.md).

## Features and limitations

- Table partitioning is supported. [You can use partitions in your SQL queries](docs/table_partitioning.md).
- Queries are parameterized when sent to BigQuery
- BigQuery's standard SQL support (legacy SQL is not supported)
- Authentication works with a "[Service Account](docs/service_account.md)" Json private key

[Read more](docs/README.md).

## Requirements

- PostgreSQL >= 9.5
- Python 3

## Dependencies

### Dependencies required to install bigquery_fdw:

- `postgresql-server-dev-X.Y`
- `python3-pip`
- `python3-dev`
- `make`
- `gcc`

### Major dependencies installed automatically during the installation process:

- [Google Cloud BigQuery](https://pypi.org/project/google-cloud-bigquery/)
- [Multicorn](https://github.com/Kozea/Multicorn)

## Installation

```bash
# Install `setuptools` if necessary
pip3 install --upgrade setuptools

# Install Multicorn
git clone git://github.com/Kozea/Multicorn.git && cd Multicorn
export PYTHON_OVERRIDE=python3
make && make install

# Install bigquery_fdw
pip3 install bigquery-fdw
```

## Usage

We recommend testing the [BigQuery client connectivity](docs/test_client.md) before trying to use the FDW.

With `psql`:

```sql
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',
fdw_key '/opt/bigquery_fdw/user.json'
);
```

## Options

List of options implemented in `CREATE FOREIGN TABLE` syntax:

| Option | Default | Description |
|-----|----|----|
| `fdw_dataset` | - | BigQuery dataset name |
| `fdw_table` | - | BigQuery table name |
| `fdw_key` | - | Path to private Json key (See [Key storage recommendations](docs/key_storage.md)) |
| `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](docs/remote_grouping.md). |
| `fdw_casting` | - | See [Casting](docs/casting.md). |
| `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](docs/README.md).


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bigquery-fdw-1.3.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bigquery_fdw-1.3.2-py2.py3-none-any.whl (11.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file bigquery-fdw-1.3.2.tar.gz.

File metadata

  • Download URL: bigquery-fdw-1.3.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bigquery-fdw-1.3.2.tar.gz
Algorithm Hash digest
SHA256 f0e82f8fb29557ddeb20136669f0ba06b3ed0cc26a2d8dbcd6ea973b7b6d870f
MD5 2747f35626ddd307ebb475ee25cdc463
BLAKE2b-256 af742e8b34ce3c082dc5b36df7b3ea987f32d15588c2f9f58fe19036d10c0d9c

See more details on using hashes here.

File details

Details for the file bigquery_fdw-1.3.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bigquery_fdw-1.3.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 33bbb7ec07d6dcdd92462d36a13d40ca504764e1d8e1d6664ab2cd13932d8599
MD5 a3beb00adeaa2f13d9bedb4c8d912884
BLAKE2b-256 09a73a4e11d1a2668f81ce355f6701c21af0a986921a4c616a273b014ac0fa3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page