How to Connect BigQuery to DataGrip

Galaxy Glossary

How do I connect Google BigQuery to JetBrains DataGrip?

Establishes a secure JDBC connection from JetBrains DataGrip to Google BigQuery so you can run SQL interactively.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

Why use DataGrip with BigQuery?

DataGrip gives developers a familiar IDE experience—code completion, version control, and refactoring—while BigQuery supplies serverless analytics power. Connecting both lets you debug, optimize, and share SQL faster.

What are the prerequisites?

Have a Google Cloud project with BigQuery enabled, a service account or OAuth credentials, the BigQuery JDBC driver (latest), and DataGrip 2022.3+ installed.

How do I add the BigQuery JDBC driver?

In DataGrip ▶ File → Settings → Database → Drivers+Custom. Enter “BigQuery”, set the class name to com.simba.googlebigquery.jdbc42.Driver, and attach the downloaded JAR.

Which connection parameters are required?

You need a JDBC URL, authentication method, and optional project/dataset defaults. The most common combo is service-account JSON with key file path.

How do I create the Data Source?

Click + in the Database tool window ➜ Driver & Data Source ➜ choose your BigQuery driver. Fill in the fields from the syntax below, test the connection, then press OK.

Can I query nested or partitioned tables?

Yes. DataGrip shows BigQuery table metadata, including partition and clustering keys. Run standard SQL; results stream back in the IDE grid.

Example: pull last month’s customer revenue

SELECT c.id,
c.name,
SUM(oi.quantity * p.price) AS revenue
FROM `project.dataset.Customers` c
JOIN `project.dataset.Orders` o ON o.customer_id = c.id
JOIN `project.dataset.OrderItems` oi ON oi.order_id = o.id
JOIN `project.dataset.Products` p ON p.id = oi.product_id
WHERE o.order_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY c.id, c.name
ORDER BY revenue DESC
LIMIT 20;

Best practices for stable connections

Use service-account keys instead of OAuth for CI/CD. Pin driver versions, enable "Limit page size" to reduce memory, and set Use legacy SQL = false in advanced parameters.

What are common mistakes?

See below for pitfalls and quick fixes.

Why How to Connect BigQuery to DataGrip is important

How to Connect BigQuery to DataGrip Example Usage


/* List products that are out of stock */
SELECT id, name, price
FROM   `my-shop.inventory.Products`
WHERE  stock = 0
ORDER  BY name;

How to Connect BigQuery to DataGrip Syntax


JDBC URL pattern:
jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=<project_id>;OAuthType=0;OAuthServiceAcctEmail=<service_account_email>;OAuthPvtKeyPath=<path_to_key.json>;DatasetId=<default_dataset>;Timeout=60;

Key parameters
• ProjectId – GCP project that owns the BigQuery datasets.
• OAuthType – 0 = Service Account, 1 = User OAuth.
• OAuthPvtKeyPath – Absolute path to JSON key file.
• DatasetId – Default dataset shown in the database tree.
• Timeout – Seconds DataGrip waits before dropping idle sessions.

Example connection (service account):
jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=my-shop;OAuthType=0;OAuthServiceAcctEmail=bq-reader@my-shop.iam.gserviceaccount.com;OAuthPvtKeyPath=/Users/alex/keys/bq.json;DatasetId=analytics;Timeout=120;

Common Mistakes

Frequently Asked Questions (FAQs)

Does DataGrip support BigQuery DDL/DML?

Yes. You can CREATE TABLE, INSERT, UPDATE, MERGE, and DROP directly. Autocomplete covers BigQuery-specific statements like CREATE TABLE AS SELECT.

Can I use parameters in BigQuery queries?

DataGrip variables (${var}) are replaced client-side, then sent to BigQuery. Alternatively, use BigQuery named parameters ( @start_date ).

Is billing affected by DataGrip?

BigQuery charges for processed bytes, not connection time. Previewing long tables or SELECT * can be costly; use LIMIT and column projection.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie
BauHealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.