- GA4 BigQuery Newsletter For Marketing Analytics
- Posts
- How to Use Google AI Model, Gemini in BigQuery
How to Use Google AI Model, Gemini in BigQuery
Use the power of AI to generate SQL queries using natural language
In the previous post, I walked you through the steps of enabling Gemini, a Google AI model, in BigQuery. In this of the post I will show you how to use AI in BigQuery.
After Gemini, Google’s AI model, is enabled in BigQuery, click on the “* Pencil” icon on the right hand side of console window. It will open up a dropdown with a list of all available Gemini features and a checkmark next to the ones that are enabled.
Clicking on the feature will allow you to disable it or enable it back again if you need it.
What Do These Features Do
Auto-Generation
With the features, you can write a natural language comment in the BigQuery query editor to generate a SQL query.
Here are the step to use this feature
Type # (hashtag ) or -- (two dashes) to start the prompt.
Next type your prompt
Wait for Gemini to process your prompt and write the SQL
Press tab to accept the SQL
In the screen below, is an example of a prompt and the SQL that Gemini wrote.
SQL generation tool
With this feature, you can enter natural language text in a tool to generate a SQL query, with options to refine query results, choose table sources, and compare results.
To use this feature, click on the *Pencil icon that appears in the query window (see the image below). You can also right click in the query window to open the SQL Generation tool.
Clicking on it will open the SQL Generation tool where you can write your prompt to generate SQL.
After you write your prompt and click “GENERATE” button, you will see the following window with SQL. You can then refine the SQL further or accept it as is. I will write more about this in the future posts.
Explanation
With this feature, you can prompt Gemini in to explain a SQL query in natural language. I will write more about this in the future posts. For now lets just see how it works.
Select SQL in the query window and right click on “Explain current selection”. This will open a panel explaining the SQL that you selected.
So that’s all for now. I hope Google AI in BigQuery helps you write better and fast SQL code. Click here to upgrade to support this newsletter and get advanced content.
Note: If you haven’t yet started with BigQuery then don’t be left behind. Here is a course to get you started, https://academy.optizent.com/courses/bigquery-sql-fundamentals-ga4?coupon=BQFUNDAMENTALSYT
If have some background in BigQuery (have been following this newsletter series) then checkout my BigQuery for Marketers and Marketing Analytics course. https://academy.optizent.com/courses/bigquery-for-marketers-and-marketing-analysts (Only BigQuery course designed for non-technical folks).
Need BigQuery and GA4 help?
Contact us at [email protected] or fill the contact us form.
Use AI as Your Personal Assistant
Ready to embrace a new era of task delegation?
HubSpot’s highly anticipated AI Task Delegation Playbook is your key to supercharging your productivity and saving precious time.
Learn how to integrate AI technology into your processes, allowing you to optimize resource allocation and maximize output with precision and ease.
Reply