Skip to main content
Version: 0.4 (Latest)

BigQuery Reference

Reference material for BigQuery Publishing -- data type mappings, CLI arguments, querying, and troubleshooting.

Data Type Mapping​

Source types map automatically to BigQuery-compatible types. LakeXpress exports through Parquet, so the mapping is driven by the normalized source type name.

Pick your source database:

PostgreSQL to BigQuery​

PostgreSQL TypeBigQuery Type
SMALLINT, INTEGER, INT4, BIGINT, INT8INT64
NUMERIC(p,s)NUMERIC
REAL, FLOAT4, DOUBLE PRECISION, FLOAT8FLOAT64
VARCHAR(n), TEXT, CHAR(n), UUID, array []STRING
BOOLEANBOOL
DATEDATE
TIMETIME
TIMESTAMP, TIMESTAMPTZTIMESTAMP
BYTEABYTES
JSON, JSONBJSON

CLI Reference​

BigQuery Publishing Arguments​

OptionTypeDescription
--publish_target IDStringCredential ID for BigQuery publishing (required)
--publish_schema_pattern PATTERNStringDynamic dataset naming pattern (default: {schema} for internal, EXT_{schema} for the default external method)
--publish_table_pattern PATTERNStringDynamic table naming pattern (default: {table})
--publish_method TYPEStringTable type: external (default) or internal
--pk_constraintsFlagAdd PRIMARY KEY constraints to native (internal) table DDL; not supported for external tables
--n_jobs NIntegerParallel workers for table creation (default: 1)

Querying BigQuery Tables​

BigQuery Console:

SELECT * FROM `my-project.lx_tpch_1.customer` LIMIT 10;

bq CLI:

bq query --use_legacy_sql=false \
'SELECT * FROM `my-project.lx_tpch_1.customer` LIMIT 10'

Python (google-cloud-bigquery):

from google.cloud import bigquery

client = bigquery.Client()
query = "SELECT * FROM `my-project.lx_tpch_1.customer` LIMIT 10"
df = client.query(query).to_dataframe()
print(df)

pandas-gbq:

import pandas_gbq

query = "SELECT * FROM `my-project.lx_tpch_1.customer` LIMIT 10"
df = pandas_gbq.read_gbq(query, project_id="my-project")
print(df)

Troubleshooting​

Common Issues​

"Permission denied" errors:

  • Verify the service account has BigQuery Data Editor role
  • Check GCS bucket access from the service account
  • Ensure project ID in credentials matches the target project

"Dataset not found" errors:

  • Check that location matches your GCS bucket region
  • Cross-region access between GCS and BigQuery may cause issues

"Invalid table" errors for external tables:

  • Verify GCS path contains valid Parquet files
  • Check schema mapping for your data types

Verifying Setup​

Test BigQuery connectivity by creating a minimal sync configuration against a single schema, then run it and check the log output:

./LakeXpress config create \
-a credentials.json \
--lxdb_auth_id lxdb_postgres \
--source_db_auth_id source_postgres \
--source_db_name mydb \
--source_schema_name public \
--target_storage_id gcs_01 \
--sub_path mydata \
--publish_target bigquery_prod \
--log_level DEBUG

There is no --tables filter or --dry_run flag for BigQuery publishing runs -- to limit scope for a connectivity check, point --source_schema_name at a schema with few tables (see the CLI Reference).

Validate credentials:

from google.cloud import bigquery
from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_file(
'/path/to/service-account.json'
)
client = bigquery.Client(credentials=credentials, project='my-project')
print(list(client.list_datasets()))

See Also​

Copyright © 2026 Architecture & Performance.