Google's BigQuery AI Converts Natural Language to SQL
Google introduces a new AI feature in BigQuery to generate SQL queries from natural language comments, accelerating data analysis and simplifying complex queries.
- Read time
- 5 min read
- Word count
- 1,026 words
- Date
- Jan 16, 2026
Summarize with AI
Google is enhancing its BigQuery data warehouse with an AI-powered feature called Comments to SQL. This innovation allows developers and data analysts to translate natural language instructions embedded in SQL comments into executable queries. The goal is to expedite data analysis, reduce the complexity of working with intricate SQL, and support enterprises in scaling their AI initiatives. This move is part of a broader industry trend to integrate artificial intelligence into data querying processes, making data access more intuitive and efficient for users across various skill levels.

🌟 Non-members read here
Google Enhances BigQuery with AI-Powered SQL Generation
Google is currently testing an innovative AI-driven feature within its BigQuery data warehouse, designed to translate natural language comments into parts of SQL queries. This development promises to accelerate data analysis and simplify the process of constructing complex queries. The initiative aims to lower the entry barrier for data professionals, allowing enterprises to streamline data access and advance their AI projects from pilot to production phases.
The new capability, named “Comments to SQL,” enables developers and data analysts to embed natural language instructions directly within SQL comments. These instructions are then converted into functional SQL queries within BigQuery Studio, offering a more intuitive way to interact with data. This advancement reflects a strategic move by Google to integrate sophisticated AI into its core data services, aligning with the growing demand for more accessible and efficient data management tools.
Streamlining Query Construction with AI
Users can activate the SQL Generation widget within BigQuery Studio to begin using the “Comments to SQL” feature. Once enabled, instructions can be written in natural language inside SQL comments, typically delimited by /* and */. These descriptions can detail desired columns, datasets, and specific filters. Gautam Gupta, a machine learning engineering manager at Google, highlighted the ease of this process in a recent blog post.
The conversion to SQL is initiated by clicking the Gemini gutter button and selecting “Convert comments to SQL.” This action generates the corresponding query and presents a difference view, illustrating how the natural language comments were translated into executable SQL code. Users can further refine their instructions to achieve the desired output, with changes reflected in an expanded view, making iterative improvements straightforward.
Gupta provided several illustrative examples of the “Comments to SQL” converter in action. One such example demonstrated a user outlining a query that required a window function and ranked data. The natural language input requested specific product information, monthly sales figures, and a ranking of products by sales within each category, based on sales data for the year 2023.
The user’s input, structured within SQL comments, would appear as follows:
SELECT /* product name, monthly sales, and rank of products by sales within each category */
FROM /* sales_data */
WHERE /* year is 2023 */
WINDOW /* partition by category order by monthly sales descending */
This natural language instruction would then be translated by the AI into a comprehensive SQL query:
SELECT
product_name,
SUM(monthly_sales) AS total_monthly_sales,
RANK() OVER (PARTITION BY category ORDER BY SUM(monthly_sales) DESC) AS sales_rank
FROM
`sales_data`
WHERE
EXTRACT(YEAR FROM sale_date) = 2023
GROUP BY
product_name, category, EXTRACT(MONTH FROM sale_date)
While this feature significantly simplifies the process, it’s important to note that the system is still evolving. Generating a complex query such as “/* give me a list of products by category, ranked by monthly sales in 2023 */” into a fully functional query that precisely matches user intent remains a challenging but future-oriented goal for such AI systems.
Enhancing Daily Data Tasks and Productivity
Robert Kramer, a principal analyst at Moor Insights and Strategy, emphasized that data professionals often conceptualize their tasks in terms of questions and desired outcomes rather than intricate syntax. He noted that translating intent into accurate and efficient SQL queries can be time-consuming, particularly when dealing with complex joins, temporal logic, and recurring patterns. Google’s new feature aims to accelerate this translation while maintaining SQL as the fundamental execution layer.
By allowing natural language expressions directly within SQL comments, Google is addressing a critical pain point for data teams. This innovation could free up valuable time that would otherwise be spent on writing and refining queries, allowing analysts to focus more on interpreting results. This shift is expected to foster more automated analytics processes, leading to faster insights, reducing inter-team handoffs, and saving considerable time during query setup.
Google has been consistently integrating AI-driven functionalities into BigQuery to assist developers and data analysts with SQL querying tasks. Last November, the company introduced three new managed AI-based SQL functions: AI.IF, AI.CLASSIFY, and AI.SCORE. These functions are designed to help enterprise users manage the complexity of large-scale analytics, especially when dealing with unstructured data, by enabling filtering, joining, categorizing, and ranking data based on semantic meaning.
Before these additions, in August, Google rolled out incremental updates to its data engineering and data science agents within BigQuery. These agents, initially announced in April, aim to automate various data analytics tasks. The data engineering agent supports pipeline building, data transformation, and troubleshooting. Meanwhile, the data science agent is designed to automate end-to-end data science workflows, from creating multi-step plans and executing code to reasoning about results and presenting findings, further solidifying BigQuery’s AI capabilities.
The Broader Trend of AI Integration in Data Warehousing
Google’s endeavors to integrate artificial intelligence into SQL querying are part of a wider industry trend. Many data warehouse and analytics service providers are actively incorporating AI to enhance data management and analysis. This collective movement underscores the industry’s commitment to making data interaction more intuitive and powerful for a diverse range of users.
Databricks, for instance, already offers AI Functions that facilitate the application of generative AI or large language model (LLM) inference directly from SQL or Python environments. This allows users to leverage advanced AI capabilities seamlessly within their existing data workflows, enabling more sophisticated analyses and applications.
Snowflake, another prominent player in the data warehousing sector, provides a suite of AI-driven functions, including AI_PARSE_DOCUMENT, AISQL, and Cortex functions. These tools are tailored for document parsing, semantic search, and advanced AI-driven analytics, empowering users to extract deeper insights from their data. The emphasis is on delivering robust AI functionalities that cater to complex data processing needs.
Other data warehouses, such as Oracle’s Autonomous Data Warehouse, also support integrated AI workflows alongside traditional SQL operations. This demonstrates a clear industry-wide recognition of the importance of blending AI with conventional data querying languages. The goal across these platforms is to democratize access to advanced analytical capabilities, enabling users with varying technical proficiencies to harness the power of AI for their data initiatives. This continuous evolution promises to redefine how businesses interact with and extract value from their vast datasets.