Skip to main content

BigQuery catalog

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​

The example connects a Google Cloud project as the catalog bigquery_catalog and lists its datasets as schemas. Two things must be on the Gravitino server first:

  1. Supply the Simba driver. The Simba BigQuery JDBC driver does not ship in the image. Enable it with gravitino.jdbcDrivers.bigquery in my-values.yaml, as described in JDBC driver.

    my-values.yaml
    gravitino:
    jdbcDrivers:
    enabled: true
    bigquery:
    enabled: true
  2. Mount the service account key. The catalog takes the path to the key file, not its contents, so the file must exist in the server pod. Mount it from a Secret as described in Google Cloud credentials, which places it at /etc/gcs/key.json.

  1. Start the catalog. Open Connect → Catalogs and click + Catalog. Enter bigquery_catalog as the Catalog name, keep Relational as the Catalog type, and choose Google BigQuery under Databases and warehouses in Select provider.

  2. Enter the connection. Under Connection, enter {project_id} as the Project ID, jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443 as the URL, the service account email as the User, and /etc/gcs/key.json as the Password. The UI requires a URL, and the connector adds the project and credentials to it. Advanced holds a Properties list for the proxy properties. The UI fills in jdbc-driver from the provider.

  3. Test and create it. Click Test connection, then Create catalog.

  4. List the datasets. In Explore, open bigquery_catalog. Each BigQuery dataset in the project comes back as a schema, across every region the project uses.

Catalog properties​

project-id and the proxy properties are BigQuery's own. The connector also gives jdbc-url, jdbc-driver, jdbc-user, and jdbc-password BigQuery-specific meanings and defaults, listed here. The pool properties are described in Shared properties.

PropertyDescriptionDefaultRequired
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.

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​

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 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​

Gravitino reads each BigQuery type as the Gravitino type in its row, and creates each Gravitino type as the BigQuery type in its row, except where the list under the table says otherwise.

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

When Gravitino creates a column:

  • byte, short and integer become INT64, and read back as long.
  • float becomes FLOAT64, and reads back as double.
  • varchar and char become STRING, and read back as string.
  • An external or unparsed type becomes the 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