BigQuery
Connect Google BigQuery to Memex for data warehouse analytics.
What is BigQuery?
BigQuery is Google Cloud's enterprise data warehouse service. It handles petabyte-scale analytics workloads without requiring infrastructure management, using a serverless architecture that scales automatically. When you connect BigQuery to Memex, you can query massive datasets, create visualizations, and generate insights—all through natural conversation.
What You'll Need
To connect BigQuery to Memex, you'll need a Google Cloud service account with the appropriate permissions:
Service Account JSON
A JSON key file containing your service account credentials
Setting Up BigQuery Access
Step 1: Create or Select a Google Cloud Project
Go to the Google Cloud Console
Create a new project or select an existing one with BigQuery data
Step 2: Enable the BigQuery API
Before creating a service account, ensure the BigQuery API is enabled:
In the Google Cloud Console, go to APIs & Services → Library
Search for "BigQuery API"
Click on it and press Enable (if not already enabled)
Step 3: Create a Service Account
In the Google Cloud Console, go to IAM & Admin → Service Accounts
Click Create Service Account
Enter a Name (e.g., "Memex BigQuery Access")
Enter a Description (optional)
Click Create and Continue
Step 4: Grant Required Permissions
Add the following roles to your service account:
BigQuery Data Viewer
Read access to query tables and view data
BigQuery Job User
Permission to run queries
Click Select a role
Search for and select BigQuery Data Viewer
Click Add another role
Search for and select BigQuery Job User
Click Continue, then Done
Step 5: Create and Download the JSON Key
Click on the service account you just created
Go to the Keys tab
Click Add Key → Create new key
Select JSON format
Click Create
The JSON key file will download automatically. Keep this file secure.
Keep your key file secure! This file provides access to your BigQuery data. Don't share it or commit it to version control.
Connecting to Memex
Open the Memex Hub from the sidebar
Click on the Connectors tab
Click on the BigQuery card
Enter a Connection Name (e.g., "Analytics Warehouse")
Open your downloaded JSON key file in a text editor
Copy the entire contents and paste into the Service Account JSON field
Click Add Connection
Your BigQuery data warehouse is now connected! Memex can access it across all your conversations.
Verifying Your Connection
After connecting, try asking Memex:
If Memex returns your dataset names, the connection is working correctly.
Using Your Connection
Once connected, you can ask Memex to work with your BigQuery data:
Security Considerations
Service Account Security
Once connected, you can delete the JSON file from your downloads—Memex stores the credentials securely
Never commit service account keys to version control
Use separate service accounts for different applications
Regularly audit which service accounts have access to your data
Limiting Access
You can restrict what the service account can access:
Grant roles at the dataset level instead of project level for finer control
Use BigQuery Data Viewer for read-only access
Avoid granting BigQuery Admin unless absolutely necessary
Granting Access at Dataset Level
For more granular control, you can grant access to specific datasets instead of the entire project:
Go to BigQuery in the Google Cloud Console
In the Explorer panel, click on the dataset name
Click Sharing → Permissions
Click Add Principal
Enter the service account email
Select BigQuery Data Viewer role
Click Save
This limits Memex to only the datasets you explicitly share.
Key Rotation
Google recommends rotating service account keys periodically:
Create a new key in the Google Cloud Console
Update your Memex connection with the new key
Delete the old key from Google Cloud
If you suspect your service account key has been compromised, delete it immediately in the Google Cloud Console and create a new one.
Troubleshooting
You can ask the Memex agent to help troubleshoot, but here are a few common problems:
"Permission denied" Error
Verify the service account has both BigQuery Data Viewer and BigQuery Job User roles
Check that roles are granted at the correct level (project or dataset)
Ensure you're querying datasets the service account can access
"Invalid JSON" Error
Make sure you copied the entire contents of the JSON file
Check that you didn't accidentally include extra characters
Verify the JSON is properly formatted (no missing braces or commas)
"Project not found" Error
Confirm the project ID in your JSON matches an existing project
Verify the BigQuery API is enabled for the project
Check that the service account belongs to the correct project
Can't See Certain Datasets
The service account only sees datasets it has permission to access
Grant BigQuery Data Viewer on specific datasets if needed
Ask your GCP administrator to verify permissions
Learn More
Last updated
Was this helpful?