Skip to main content

BigQuery Catalog

Overview

The BigQuery catalog connects Gravitino to a Google BigQuery project through JDBC, with the provider name jdbc-bigquery. BigQuery datasets appear as schemas and BigQuery tables as tables, and Gravitino reads and writes through to BigQuery, so the project stays authoritative.

Gravitino authenticates as a Google Cloud service account, using that account's JSON key file.

Quick Start

1. Put the service account key where the server can read it. The catalog takes the path to the key file, not its contents, so the file must exist on the Gravitino server. On Kubernetes, mount it into the server pod from a secret. The Simba BigQuery JDBC driver ships inside the connector, so there is no driver to download.

2. Create the catalog. Name the project, the service account, and the key file path.

curl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/catalogs" \
-H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"name": "bigquery_catalog",
"type": "RELATIONAL",
"provider": "jdbc-bigquery",
"comment": "BigQuery catalog",
"properties": {
"project-id": "{project_id}",
"jdbc-user": "{service_account_email}",
"jdbc-password": "/etc/gravitino/bigquery/{key_file}.json"
}
}'

3. List the datasets. Each BigQuery dataset in the project comes back as a schema, across every region the project uses.

Catalog Properties

Property NameDescriptionDefault ValueRequired
project-idGoogle Cloud project ID(none)Yes
jdbc-userService account email(none)Yes
jdbc-passwordPath to the service account's JSON key file on the Gravitino server(none)Yes
jdbc-urlJDBC URL. Built from the properties above when not setjdbc:bigquery://https://www.googleapis.com/bigquery/v2:443No
jdbc-driverJDBC driver classcom.simba.googlebigquery.jdbc42.DriverNo
proxy-hostProxy host or IP address(none)No
proxy-portProxy port, from 1 to 65535. Required when proxy-host is set(none)No
proxy-usernameProxy username(none)No
proxy-passwordProxy password. Hidden in catalog responses(none)No

A jdbc-url that already carries ProjectId= and either OAuthServiceAcctEmail= or OAuthType= is used as written, and jdbc-user and jdbc-password are then not required. Use that form only when the Simba driver needs connection options the properties above do not cover.

The connection pool settings every JDBC catalog accepts apply here too. See Connecting a Catalog.

Schemas

A schema is a BigQuery dataset. Dropping a schema that still holds tables fails unless the drop is a cascade, which removes the tables with it. INFORMATION_SCHEMA and SYS are reserved and cannot be used as schema names.

Property NameDescriptionChangeable
locationDataset location, such as us, eu, or asia-northeast1No
default_collationDefault collation for STRING columns, such as und:ci for case-insensitiveNo
descriptionDataset descriptionYes
friendly_nameDisplay nameYes
labelsLabels as a JSON array, [{"key":"value"}]Yes
tagsIAM tags as a JSON array, [{"key":"value"}]Yes
default_table_expiration_daysDays after which new tables expireYes
default_partition_expiration_daysDays after which new partitions expireYes
is_case_insensitiveWhether table and column names in the dataset are case-insensitiveYes
storage_billing_modelLOGICAL or PHYSICALYes
max_time_travel_hoursTime travel window, a multiple of 24 from 48 to 168Yes
default_kms_key_nameDefault Cloud KMS key for tables in the datasetYes
default_rounding_modeROUND_HALF_EVEN or ROUND_HALF_AWAY_FROM_ZEROYes
failover_reservationReservation to use in a failoverYes
is_primaryWhether this dataset is the primary replicaYes
primary_replicaName of the replica to make primaryYes

Tables

Table Properties

Property NameDescription
descriptionTable description
friendly_nameDisplay name
labelsLabels as a JSON array, [{"key":"value"}]
tagsIAM tags as a JSON array, [{"key":"value"}]
clustering_fieldsComma-separated clustering columns, at most four
partition_expiration_daysDays after which partitions expire; fractional values are allowed
require_partition_filterWhether queries must filter on the partition column
expiration_timestampWhen the table expires, in ISO 8601, such as 2027-12-31T23:59:59Z
kms_key_nameCloud KMS key for the table
default_rounding_modeRounding mode for NUMERIC and BIGNUMERIC columns
max_stalenessHow far behind current time reads may be, as INTERVAL "4:0:0" HOUR TO SECOND
enable_change_historyCapture change history for the CHANGES function
enable_fine_grained_mutationsEnable fine-grained DML optimization
storage_uriFor a managed Iceberg table, the gs:// location of its data
file_formatFor a managed Iceberg table, PARQUET
table_formatFor a managed Iceberg table, ICEBERG

Indexes, Sort Orders, and Distribution

BigQuery has no indexes or constraints, so a table created with an index is rejected. Sort orders and distribution are rejected as well. Clustering takes their place and is set with the clustering_fields property.

Partitioning

A table can be partitioned on one column.

TransformColumn Types
dayDATE, TIMESTAMP, DATETIME
monthDATE, TIMESTAMP, DATETIME
yearDATE, TIMESTAMP, DATETIME
hourTIMESTAMP, DATETIME
identityDATE, TIMESTAMP, DATETIME

Identity partitioning on a TIMESTAMP or DATETIME column partitions by its date, the same as day. Partitioning on an integer column is not supported by the connector yet, although BigQuery itself supports it through integer ranges.

Supported Table Changes

ChangeNotes
Rename a tableWithin the same dataset
Update the comment
Set a property
Add a column
Delete a column
Rename a column
Change a column's typeOnly where BigQuery allows the conversion
Make a column nullableA nullable column cannot be made NOT NULL again

Any other change is rejected.

Identifier Case and Quoting

Dataset, table, and column names start with a letter or underscore, contain only letters, digits, and underscores, and are 1 to 1024 characters long. __TABLES__, __TABLES_SUMMARY__, __PARTITIONS__, and __PARTITIONS_SUMMARY__ are reserved table names. Gravitino quotes names with backticks when it generates SQL. Whether names are case-sensitive is decided per dataset by is_case_insensitive.

Type Mapping

BigQuery to Gravitino

BigQuery TypeGravitino Type
BOOLboolean
INT64long
FLOAT64double
NUMERIC(p, s)decimal(p, s), or decimal(38, 9) when precision is unknown
STRINGstring
BYTESbinary
DATEdate
TIMEtime
DATETIMEtimestamp
TIMESTAMPtimestamp_tz
BIGNUMERIC, GEOGRAPHY, JSON, STRUCT, RANGE, and any other typeExternal type, carrying the BigQuery type name

Gravitino to BigQuery

Gravitino TypeBigQuery Type
booleanBOOL
byte, short, integer, longINT64
float, doubleFLOAT64
string, varchar, charSTRING
binaryBYTES
dateDATE
timeTIME
timestampDATETIME
timestamp_tzTIMESTAMP
decimal(p, s)NUMERIC(p, s)
External or unparsed typeThe type as written, such as ARRAY<INT64> or STRUCT<a INT64>

Error Mapping

BigQuery ErrorGravitino Error
Table not foundNoSuchTableException
Dataset not foundNoSuchSchemaException
Table already existsTableAlreadyExistsException
Dataset already existsSchemaAlreadyExistsException
Permission or access deniedA runtime error naming the denial
Invalid requestA runtime error naming the problem