Google Cloud Data Agent Kit extension for Visual Studio Code unified SQL editor lets you run SQL queries against your Google Cloud data directly within Visual Studio Code.
Supported data sources
The extension lets you query tables and views in the following Google Cloud data services:
- BigQuery
- Spanner
- AlloyDB for PostgreSQL
- Cloud SQL for MySQL
- Cloud SQL for PostgreSQL
For AlloyDB and Cloud SQL, queries using IAM authentication are supported. You can't query databases configured to use Auth Proxy or password-based authentication.
Before you begin
Before querying your data, do the following:
- Install the extension
- Configure extension settings.
- Review the guidance at Find and explore data.
Create a new SQL file
You can open the SQL editor in multiple ways.
Create a new SQL file from the File menu
- In the VS Code menu bar, click File and then New Text File. An untitled file appears in the editor.
- Save the new file with the
.sqlextension. - Click Select Connection in the editor tab.
- In the Query Settings editor, select either BigQuery or Databases.
- If you select Databases, select the database engine, database, and instance or cluster as prompted.
- Click Save to save the settings for this query.
Create a new query from the Catalog
- In the Google Cloud Data Agent Kit tab in the activity bar, expand Catalog to find the dataset that you want to query.
- Right-click or ctrl+click the name of the dataset and then select Query to open a new SQL file preconfigured for that dataset.
Create a new query from the BigQuery section
- In the Google Cloud Data Agent Kit tab in the activity bar, expand BigQuery.
- Click + New Query. An untitled SQL file configured with BigQuery as its data source appears in the editor.
Change query settings
Query settings are specific to each SQL file. After you open a SQL file, you can change the settings.
- In the editor, click the displayed data source. The Query Settings editor appears.
- Change the data source and then click Save.
Run a query
After you have created a query file and composed your query, click ▷ Run Query.
The Results tab of the Query Results pane shows the query results.
To run a subset of the SQL statements in the query editor, highlight the subset before clicking ▷ Run Query.
SQL editor features
Not all SQL editor features are supported for every data source type. The following table lists the SQL editor features that are supported per data source type during the Preview.
Feature |
BigQuery |
Spanner |
Cloud SQL |
AlloyDB for PostgreSQL |
Query results pane tabs |
||||
Query results |
✅ |
✅ |
✅ |
✅ |
Job information |
✅ |
Not applicable |
Not applicable |
Not applicable |
Execution details |
✅ |
❌ Not supported |
❌ Not supported |
❌ Not supported |
Visualization |
✅ |
✅ |
✅ |
✅ |
SQL editor configuration |
||||
Query settings |
✅ |
✅ |
✅ |
✅ |
Additional features |
||||
Multi-statement query support |
✅ |
✅ |
✅ |
✅ |
Catalog: Insert resource name in editor |
✅ |
✅ |
✅ |
✅ |