Only English
language prompts are supported for Gemini in
Dataform.
This document is intended for data analysts, data scientists, and data
developers who work withworkflows in Dataform.
It assumes you have knowledge of Google SQL syntax and
how to create Dataform workflow actions.
Before you begin
In the Google Cloud console, go to the project selector page.
You can provide Gemini with a natural language statement (orprompt) to generate a SQL or Dataform core query based onworkflow actionsdefined in your repository.
For example, you can use Gemini
to generate a SQLSELECTstatement in a.sqlxtable definition file.
To generate a SQL or Dataform core query, follow these steps:
In the Google Cloud console, go to theDataformpage.
In the Gemini dialog, enter a natural language prompt.
If you know the SQL action that you want to use, then you can specify
the action name in backticks (`) in your prompt.
ClickGenerate.
Gemini reviews the SQL actions defined in your repository
to find actions that might be relevant to your prompt and suggests a query.
Optional: To provide feedback, clickthumb_upLike suggestion,thumb_downDislike suggestion, orchat_infoGive more feedback
To accept the suggestion, clickInsert.
Tips for query generation
The following tips can improve suggestions that Gemini in
Dataform provides:
Provide the SQL action name
enclosed in backticks (`), such as`action_name`.
If the column names or their semantic relationships are unclear or complex,
then you can provide context in the prompt to guide Gemini towards
the answer that you want. This technique is known asprompt engineering. For
example, to encourage a generated query to reference a column name, describe
the column name and its relevance to the answer that you want. To encourage
an answer that references complex terms likelifetime valueorgross
margin, describe the concept and its relevance to your data to improve SQL
generation results.
Gemini and Dataform data
Gemini in Dataform can access the metadata of the
tables that you have permission to access. This can include the table names,
column names, data types, and column descriptions. Gemini in
Dataform cannot access the data in your tables, views, or
models. For more information on how Gemini uses your data, seeHow Gemini for Google Cloud uses your
data.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eGemini, an AI-powered tool in Google Cloud, can generate SQL and Dataform core code within \u003ccode\u003e.sqlx\u003c/code\u003e files in Dataform.\u003c/p\u003e\n"],["\u003cp\u003eGemini in Dataform uses natural language prompts to create SQL or Dataform core queries based on SQL workflow actions in your repository.\u003c/p\u003e\n"],["\u003cp\u003eTo use Gemini in Dataform, you must select or create a Google Cloud project and activate the feature in BigQuery.\u003c/p\u003e\n"],["\u003cp\u003eWhile using Gemini for generating code, you can provide feedback, and are recommended to validate its output due to its early-stage development.\u003c/p\u003e\n"],["\u003cp\u003eGemini in Dataform can access table metadata but not the actual data within tables, views, or models.\u003c/p\u003e\n"]]],[],null,["# Create actions with Gemini assistance\n\n| **Preview\n| --- Gemini in Dataform**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nYou can use [Gemini](/gemini/docs/overview), an AI-powered\ncollaborator in Google Cloud, to generate SQL and Dataform core\ncode inside `.sqlx` files in Dataform.\n\n\u003cbr /\u003e\n\nLearn [how and when Gemini\nfor Google Cloud uses your data](/gemini/docs/discover/data-governance).\nOnly English language prompts are supported for Gemini in Dataform.\n\n\u003cbr /\u003e\n\nThis document is intended for data analysts, data scientists, and data\ndevelopers who work with\n[workflows in Dataform](/dataform/docs/sql-workflows).\nIt assumes you have knowledge of Google SQL syntax and\nhow to create Dataform workflow actions.\n\nBefore you begin\n----------------\n\n1. In the Google Cloud console, go to the project selector page.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n2. Select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n3. [Activate Gemini in BigQuery](/gemini/docs/bigquery/set-up-gemini#activate).\n\n\u003cbr /\u003e\n\nGenerate a query\n----------------\n\n| As an early-stage technology, Gemini for Google Cloud\n| products can generate output that seems plausible but is factually incorrect. We recommend that you\n| validate all output from Gemini for Google Cloud products before you use it.\n| For more information, see\n| [Gemini for Google Cloud and responsible AI](/gemini/docs/discover/responsible-ai).\n\nYou can provide Gemini with a natural language statement (or\n*prompt* ) to generate a SQL or Dataform core query based on\n[workflow actions](/dataform/docs/sql-workflows) defined in your repository.\nFor example, you can use Gemini\nto generate a SQL `SELECT` statement in a `.sqlx` table definition file.\n\nTo generate a SQL or Dataform core query, follow these steps:\n\n1. In the Google Cloud console, go to the **Dataform** page.\n\n [Go to the Dataform page](https://console.cloud.google.com/bigquery/dataform)\n2. Select or [create a repository](/dataform/docs/create-repository),\n and then select or [create a workspace](/dataform/docs/create-workspace).\n\n3. In the **Files** pane, select or create a `.sqlx` file.\n\n4. In the file tab, click\n\n pen_spark\n **Gemini**.\n\n5. In the Gemini dialog, enter a natural language prompt.\n\n If you know the SQL action that you want to use, then you can specify\n the action name in backticks (`````) in your prompt.\n6. Click **Generate**.\n\n Gemini reviews the SQL actions defined in your repository\n to find actions that might be relevant to your prompt and suggests a query.\n7. Optional: To provide feedback, click thumb_up **Like suggestion** , thumb_down **Dislike suggestion** , or chat_info **Give more feedback**\n\n8. To accept the suggestion, click **Insert**.\n\n### Tips for query generation\n\nThe following tips can improve suggestions that Gemini in\nDataform provides:\n\n- Provide the SQL action name enclosed in backticks (`````), such as ``````action_name``````.\n- If the column names or their semantic relationships are unclear or complex, then you can provide context in the prompt to guide Gemini towards the answer that you want. This technique is known as *prompt engineering* . For example, to encourage a generated query to reference a column name, describe the column name and its relevance to the answer that you want. To encourage an answer that references complex terms like *lifetime value* or *gross\n margin*, describe the concept and its relevance to your data to improve SQL generation results.\n\n### Gemini and Dataform data\n\nGemini in Dataform can access the metadata of the\ntables that you have permission to access. This can include the table names,\ncolumn names, data types, and column descriptions. Gemini in\nDataform cannot access the data in your tables, views, or\nmodels. For more information on how Gemini uses your data, see\n[How Gemini for Google Cloud uses your\ndata](/gemini/docs/discover/data-governance).\n\nWhat's next\n-----------\n\n- For information about Gemini for Google Cloud, see [Gemini for Google Cloud overview](/gemini/docs/overview).\n- For information about the Gemini data policy, see [How Gemini for Google Cloud uses your data](/gemini/docs/discover/data-governance)."]]