Generate the SQL code automatically with the SQL Copilot for BigQuery: step-by-step instructions

Step 1. Add context with project tables

To start, provide the SQL Copilot with the project, dataset, and table that you want to be included in the query.

For example, if your project ID is "myproject", your dataset ID is "sales_data", and your table ID is "transactions", provide the following information: "myproject.sales_data.transactions".

This is required to simplify the process of generating the SQL query. As large organizations tend to have dozens of projects with hundreds of datasets and tables, this enables GPT to focus on the data you need right away.

Table details.png

The SQL Copilot plugin will prompt you to allow the action to authorize access to BigQuery. It is used to fetch the details about the data schema, such as tables, columns, and important information like if the data is partitioned, etc.

This enables the GPT with the context to provide you with accurate results. In addition, the integration with BigQuery will help the plugin to validate the query with the “dry run” once the SQL code is generated. In case there will be any issues, it will get the type of error and will fix it automatically.

After the integration is authorized, you may add more tables using a similar format ("myproject.sales_data.transactions"). You can add as many as you need to be included in the query, and you can even do this in bulk, including all of them in one message!

Step 2. Generate SQL code automatically

SQl Query.png

Once the plugin has the details about your data schema, it is ready to generate the SQL code for you. In fact, you may use the conversation multiple times and later on if you need to fetch different insights from the same tables.

Simply ask what you need to learn from the query, and The SQL Copilot plugin will generate the full query and automatically verify that it works. The work here is done!

 

Step 3. Automatically detect & fix the issues

If you logged into BigQuery at the beginning of the conversation, The SQL Copilot plugin will be able to automatically verify if the generated query would work for you. It will perform the dry run in your dataset, and validate the response from BigQuery.

In most cases, it should work right away, but in case there is an issue with the formatting or some objects, it will get the description of the issues and will fix it automatically without you needing to switch tabs to do it yourself.

 

Step 4. Upload the report to Google Sheets

In case the data from your report are required to be shared with your team members, you may find the OWOX BI BigQuery Reports extension for Google Sheets useful. You may share the query with your team, and enable the schedule to automatically update & share dashboards so your team will always have a fresh report before that daily or weekly meeting. It’s also free to install!

 

Feel free to submit your feedback to us at bi@owox.com.

 

 

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.