fix: Include back-ticks around the BQ asset names in the tools examples

These changes add extra hint for the LLM in the `execute_tool` SQL examples to always use back-ticks around BQ project, dataset and table names in the generated SQL, to save the SQL parsing error when the name has special characters.

PiperOrigin-RevId: 852418943
This commit is contained in:
Google Team Member
2026-01-05 12:52:49 -08:00
committed by Copybara-Service
parent 93d6e4c888
commit 8789ad8f16
2 changed files with 80 additions and 80 deletions
+40 -40
View File
@@ -229,7 +229,7 @@ def execute_sql(
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -253,7 +253,7 @@ def execute_sql(
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -269,7 +269,7 @@ def execute_sql(
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -319,7 +319,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -343,7 +343,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -359,7 +359,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -374,7 +374,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Create a table with schema prescribed:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table "
... "CREATE TABLE `my_project`.`my_dataset`.`my_table` "
... "(island STRING, population INT64)")
{
"status": "SUCCESS",
@@ -384,7 +384,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Insert data into an existing table:
>>> execute_sql("my_project",
... "INSERT INTO my_project.my_dataset.my_table (island, population) "
... "INSERT INTO `my_project`.`my_dataset`.`my_table` (island, population) "
... "VALUES ('Dream', 124), ('Biscoe', 168)")
{
"status": "SUCCESS",
@@ -394,9 +394,9 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Create a table from the result of a query:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table AS "
... "CREATE TABLE `my_project`.`my_dataset`.`my_table` AS "
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": []
@@ -405,7 +405,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Delete a table:
>>> execute_sql("my_project",
... "DROP TABLE my_project.my_dataset.my_table")
... "DROP TABLE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -414,8 +414,8 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Copy a table to another table:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table_clone "
... "CLONE my_project.my_dataset.my_table")
... "CREATE TABLE `my_project`.`my_dataset`.`my_table_clone` "
... "CLONE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -425,8 +425,8 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
table:
>>> execute_sql("my_project",
... "CREATE SNAPSHOT TABLE my_project.my_dataset.my_table_snapshot "
... "CLONE my_project.my_dataset.my_table")
... "CREATE SNAPSHOT TABLE `my_project`.`my_dataset`.`my_table_snapshot` "
... "CLONE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -435,9 +435,9 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Create a BigQuery ML linear regression model:
>>> execute_sql("my_project",
... "CREATE MODEL `my_dataset.my_model` "
... "CREATE MODEL `my_dataset`.`my_model` "
... "OPTIONS (model_type='linear_reg', input_label_cols=['body_mass_g']) AS "
... "SELECT * FROM `bigquery-public-data.ml_datasets.penguins` "
... "SELECT * FROM `bigquery-public-data`.`ml_datasets`.`penguins` "
... "WHERE body_mass_g IS NOT NULL")
{
"status": "SUCCESS",
@@ -447,7 +447,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Evaluate BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset.my_model`)")
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset`.`my_model`)")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -461,8 +461,8 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Evaluate BigQuery ML model on custom data:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset.my_model`, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset`.`my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -476,8 +476,8 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Predict using BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.PREDICT(MODEL `my_dataset.my_model`, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.PREDICT(MODEL `my_dataset`.`my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [
@@ -494,7 +494,7 @@ def _execute_sql_write_mode(*args, **kwargs) -> dict:
Delete a BigQuery ML model:
>>> execute_sql("my_project", "DROP MODEL `my_dataset.my_model`")
>>> execute_sql("my_project", "DROP MODEL `my_dataset`.`my_model`")
{
"status": "SUCCESS",
"rows": []
@@ -539,7 +539,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -563,7 +563,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -579,7 +579,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -594,7 +594,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Create a temporary table with schema prescribed:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table (island STRING, population INT64)")
... "CREATE TEMP TABLE `my_table` (island STRING, population INT64)")
{
"status": "SUCCESS",
"rows": []
@@ -603,7 +603,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Insert data into an existing temporary table:
>>> execute_sql("my_project",
... "INSERT INTO my_table (island, population) "
... "INSERT INTO `my_table` (island, population) "
... "VALUES ('Dream', 124), ('Biscoe', 168)")
{
"status": "SUCCESS",
@@ -613,9 +613,9 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Create a temporary table from the result of a query:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table AS "
... "CREATE TEMP TABLE `my_table` AS "
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": []
@@ -623,7 +623,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Delete a temporary table:
>>> execute_sql("my_project", "DROP TABLE my_table")
>>> execute_sql("my_project", "DROP TABLE `my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -632,7 +632,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Copy a temporary table to another temporary table:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table_clone CLONE my_table")
... "CREATE TEMP TABLE `my_table_clone` CLONE `my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -641,9 +641,9 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Create a temporary BigQuery ML linear regression model:
>>> execute_sql("my_project",
... "CREATE TEMP MODEL my_model "
... "CREATE TEMP MODEL `my_model` "
... "OPTIONS (model_type='linear_reg', input_label_cols=['body_mass_g']) AS"
... "SELECT * FROM `bigquery-public-data.ml_datasets.penguins` "
... "SELECT * FROM `bigquery-public-data`.`ml_datasets`.`penguins` "
... "WHERE body_mass_g IS NOT NULL")
{
"status": "SUCCESS",
@@ -652,7 +652,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Evaluate BigQuery ML model:
>>> execute_sql("my_project", "SELECT * FROM ML.EVALUATE(MODEL my_model)")
>>> execute_sql("my_project", "SELECT * FROM ML.EVALUATE(MODEL `my_model`)")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -666,8 +666,8 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Evaluate BigQuery ML model on custom data:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL my_model, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.EVALUATE(MODEL `my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -681,8 +681,8 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Predict using BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.PREDICT(MODEL my_model, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.PREDICT(MODEL `my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [
@@ -699,7 +699,7 @@ def _execute_sql_protected_write_mode(*args, **kwargs) -> dict:
Delete a BigQuery ML model:
>>> execute_sql("my_project", "DROP MODEL my_model")
>>> execute_sql("my_project", "DROP MODEL `my_model`")
{
"status": "SUCCESS",
"rows": []
@@ -114,7 +114,7 @@ async def test_execute_sql_declaration_read_only(tool_settings):
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -138,7 +138,7 @@ async def test_execute_sql_declaration_read_only(tool_settings):
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -154,7 +154,7 @@ async def test_execute_sql_declaration_read_only(tool_settings):
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -213,7 +213,7 @@ async def test_execute_sql_declaration_write(tool_settings):
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -237,7 +237,7 @@ async def test_execute_sql_declaration_write(tool_settings):
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -253,7 +253,7 @@ async def test_execute_sql_declaration_write(tool_settings):
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -268,7 +268,7 @@ async def test_execute_sql_declaration_write(tool_settings):
Create a table with schema prescribed:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table "
... "CREATE TABLE `my_project`.`my_dataset`.`my_table` "
... "(island STRING, population INT64)")
{
"status": "SUCCESS",
@@ -278,7 +278,7 @@ async def test_execute_sql_declaration_write(tool_settings):
Insert data into an existing table:
>>> execute_sql("my_project",
... "INSERT INTO my_project.my_dataset.my_table (island, population) "
... "INSERT INTO `my_project`.`my_dataset`.`my_table` (island, population) "
... "VALUES ('Dream', 124), ('Biscoe', 168)")
{
"status": "SUCCESS",
@@ -288,9 +288,9 @@ async def test_execute_sql_declaration_write(tool_settings):
Create a table from the result of a query:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table AS "
... "CREATE TABLE `my_project`.`my_dataset`.`my_table` AS "
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": []
@@ -299,7 +299,7 @@ async def test_execute_sql_declaration_write(tool_settings):
Delete a table:
>>> execute_sql("my_project",
... "DROP TABLE my_project.my_dataset.my_table")
... "DROP TABLE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -308,8 +308,8 @@ async def test_execute_sql_declaration_write(tool_settings):
Copy a table to another table:
>>> execute_sql("my_project",
... "CREATE TABLE my_project.my_dataset.my_table_clone "
... "CLONE my_project.my_dataset.my_table")
... "CREATE TABLE `my_project`.`my_dataset`.`my_table_clone` "
... "CLONE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -319,8 +319,8 @@ async def test_execute_sql_declaration_write(tool_settings):
table:
>>> execute_sql("my_project",
... "CREATE SNAPSHOT TABLE my_project.my_dataset.my_table_snapshot "
... "CLONE my_project.my_dataset.my_table")
... "CREATE SNAPSHOT TABLE `my_project`.`my_dataset`.`my_table_snapshot` "
... "CLONE `my_project`.`my_dataset`.`my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -329,9 +329,9 @@ async def test_execute_sql_declaration_write(tool_settings):
Create a BigQuery ML linear regression model:
>>> execute_sql("my_project",
... "CREATE MODEL `my_dataset.my_model` "
... "CREATE MODEL `my_dataset`.`my_model` "
... "OPTIONS (model_type='linear_reg', input_label_cols=['body_mass_g']) AS "
... "SELECT * FROM `bigquery-public-data.ml_datasets.penguins` "
... "SELECT * FROM `bigquery-public-data`.`ml_datasets`.`penguins` "
... "WHERE body_mass_g IS NOT NULL")
{
"status": "SUCCESS",
@@ -341,7 +341,7 @@ async def test_execute_sql_declaration_write(tool_settings):
Evaluate BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset.my_model`)")
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset`.`my_model`)")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -355,8 +355,8 @@ async def test_execute_sql_declaration_write(tool_settings):
Evaluate BigQuery ML model on custom data:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset.my_model`, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.EVALUATE(MODEL `my_dataset`.`my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -370,8 +370,8 @@ async def test_execute_sql_declaration_write(tool_settings):
Predict using BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.PREDICT(MODEL `my_dataset.my_model`, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.PREDICT(MODEL `my_dataset`.`my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [
@@ -388,7 +388,7 @@ async def test_execute_sql_declaration_write(tool_settings):
Delete a BigQuery ML model:
>>> execute_sql("my_project", "DROP MODEL `my_dataset.my_model`")
>>> execute_sql("my_project", "DROP MODEL `my_dataset`.`my_model`")
{
"status": "SUCCESS",
"rows": []
@@ -450,7 +450,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
>>> execute_sql("my_project",
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": [
@@ -474,7 +474,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
>>> execute_sql(
... "my_project",
... "SELECT island FROM "
... "bigquery-public-data.ml_datasets.penguins",
... "`bigquery-public-data`.`ml_datasets`.`penguins`",
... dry_run=True
... )
{
@@ -490,7 +490,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
"tableId": "anon..."
},
"priority": "INTERACTIVE",
"query": "SELECT island FROM bigquery-public-data.ml_datasets.penguins",
"query": "SELECT island FROM `bigquery-public-data`.`ml_datasets`.`penguins`",
"useLegacySql": False,
"writeDisposition": "WRITE_TRUNCATE"
}
@@ -505,7 +505,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Create a temporary table with schema prescribed:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table (island STRING, population INT64)")
... "CREATE TEMP TABLE `my_table` (island STRING, population INT64)")
{
"status": "SUCCESS",
"rows": []
@@ -514,7 +514,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Insert data into an existing temporary table:
>>> execute_sql("my_project",
... "INSERT INTO my_table (island, population) "
... "INSERT INTO `my_table` (island, population) "
... "VALUES ('Dream', 124), ('Biscoe', 168)")
{
"status": "SUCCESS",
@@ -524,9 +524,9 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Create a temporary table from the result of a query:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table AS "
... "CREATE TEMP TABLE `my_table` AS "
... "SELECT island, COUNT(*) AS population "
... "FROM bigquery-public-data.ml_datasets.penguins GROUP BY island")
... "FROM `bigquery-public-data`.`ml_datasets`.`penguins` GROUP BY island")
{
"status": "SUCCESS",
"rows": []
@@ -534,7 +534,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Delete a temporary table:
>>> execute_sql("my_project", "DROP TABLE my_table")
>>> execute_sql("my_project", "DROP TABLE `my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -543,7 +543,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Copy a temporary table to another temporary table:
>>> execute_sql("my_project",
... "CREATE TEMP TABLE my_table_clone CLONE my_table")
... "CREATE TEMP TABLE `my_table_clone` CLONE `my_table`")
{
"status": "SUCCESS",
"rows": []
@@ -552,9 +552,9 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Create a temporary BigQuery ML linear regression model:
>>> execute_sql("my_project",
... "CREATE TEMP MODEL my_model "
... "CREATE TEMP MODEL `my_model` "
... "OPTIONS (model_type='linear_reg', input_label_cols=['body_mass_g']) AS"
... "SELECT * FROM `bigquery-public-data.ml_datasets.penguins` "
... "SELECT * FROM `bigquery-public-data`.`ml_datasets`.`penguins` "
... "WHERE body_mass_g IS NOT NULL")
{
"status": "SUCCESS",
@@ -563,7 +563,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Evaluate BigQuery ML model:
>>> execute_sql("my_project", "SELECT * FROM ML.EVALUATE(MODEL my_model)")
>>> execute_sql("my_project", "SELECT * FROM ML.EVALUATE(MODEL `my_model`)")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -577,8 +577,8 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Evaluate BigQuery ML model on custom data:
>>> execute_sql("my_project",
... "SELECT * FROM ML.EVALUATE(MODEL my_model, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.EVALUATE(MODEL `my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [{'mean_absolute_error': 227.01223667447218,
@@ -592,8 +592,8 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Predict using BigQuery ML model:
>>> execute_sql("my_project",
... "SELECT * FROM ML.PREDICT(MODEL my_model, "
... "(SELECT * FROM `my_dataset.my_table`))")
... "SELECT * FROM ML.PREDICT(MODEL `my_model`, "
... "(SELECT * FROM `my_dataset`.`my_table`))")
{
"status": "SUCCESS",
"rows": [
@@ -610,7 +610,7 @@ async def test_execute_sql_declaration_protected_write(tool_settings):
Delete a BigQuery ML model:
>>> execute_sql("my_project", "DROP MODEL my_model")
>>> execute_sql("my_project", "DROP MODEL `my_model`")
{
"status": "SUCCESS",
"rows": []