Skip to content

Commit 3ae6ce1

Browse files
google-genai-botcopybara-github
authored andcommitted
docs: Update code example in tool declaration to reflect BigQuery artifact description
PiperOrigin-RevId: 769203265
1 parent 13f98c3 commit 3ae6ce1

File tree

1 file changed

+101
-86
lines changed

1 file changed

+101
-86
lines changed

src/google/adk/tools/bigquery/metadata_tool.py

Lines changed: 101 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,37 @@ def get_dataset_info(
6969
dict: Dictionary representing the properties of the dataset.
7070
7171
Examples:
72-
>>> get_dataset_info("bigquery-public-data", "penguins")
72+
>>> get_dataset_info("bigquery-public-data", "cdc_places")
7373
{
7474
"kind": "bigquery#dataset",
75-
"etag": "PNC5907iQbzeVcAru/2L3A==",
76-
"id": "bigquery-public-data:ml_datasets",
77-
"selfLink":
78-
"https://bigquery.googleapis.com/bigquery/v2/projects/bigquery-public-data/datasets/ml_datasets",
75+
"etag": "fz9BaiXKgbGi53EpI2rJug==",
76+
"id": "bigquery-public-data:cdc_places",
77+
"selfLink": "https://content-bigquery.googleapis.com/bigquery/v2/projects/bigquery-public-data/datasets/cdc_places",
7978
"datasetReference": {
80-
"datasetId": "ml_datasets",
81-
"projectId": "bigquery-public-data"
79+
"datasetId": "cdc_places",
80+
"projectId": "bigquery-public-data"
8281
},
82+
"description": "Local Data for Better Health, County Data",
8383
"access": [
84-
{
85-
"role": "OWNER",
86-
"groupByEmail": "[email protected]"
87-
},
88-
{
89-
"role": "READER",
90-
"iamMember": "allUsers"
91-
},
92-
{
93-
"role": "READER",
94-
"groupByEmail": "[email protected]"
95-
}
84+
{
85+
"role": "WRITER",
86+
"specialGroup": "projectWriters"
87+
},
88+
{
89+
"role": "OWNER",
90+
"specialGroup": "projectOwners"
91+
},
92+
{
93+
"role": "OWNER",
94+
"userByEmail": "[email protected]"
95+
},
96+
{
97+
"role": "READER",
98+
"specialGroup": "projectReaders"
99+
}
96100
],
97-
"creationTime": "1553208775542",
98-
"lastModifiedTime": "1686338918114",
101+
"creationTime": "1640891845643",
102+
"lastModifiedTime": "1640891845643",
99103
"location": "US",
100104
"type": "DEFAULT",
101105
"maxTimeTravelHours": "168"
@@ -128,13 +132,9 @@ def list_table_ids(
128132
list[str]: List of the tables ids present in the dataset.
129133
130134
Examples:
131-
>>> list_table_ids("bigquery-public-data", "ml_datasets")
132-
['census_adult_income',
133-
'credit_card_default',
134-
'holidays_and_events_for_forecasting',
135-
'iris',
136-
'penguins',
137-
'ulb_fraud_detection']
135+
>>> list_table_ids("bigquery-public-data", "cdc_places")
136+
['chronic_disease_indicators',
137+
'local_data_for_better_health_county_data']
138138
"""
139139
try:
140140
bq_client = client.get_bigquery_client(credentials=credentials)
@@ -167,72 +167,87 @@ def get_table_info(
167167
dict: Dictionary representing the properties of the table.
168168
169169
Examples:
170-
>>> get_table_info("bigquery-public-data", "ml_datasets", "penguins")
170+
>>> get_table_info("bigquery-public-data", "cdc_places", "local_data_for_better_health_county_data")
171171
{
172172
"kind": "bigquery#table",
173-
"etag": "X0ZkRohSGoYvWemRYEgOHA==",
174-
"id": "bigquery-public-data:ml_datasets.penguins",
175-
"selfLink":
176-
"https://bigquery.googleapis.com/bigquery/v2/projects/bigquery-public-data/datasets/ml_datasets/tables/penguins",
173+
"etag": "wx23aDqmgc39oUSiNuYTAA==",
174+
"id": "bigquery-public-data:cdc_places.local_data_for_better_health_county_data",
175+
"selfLink": "https://content-bigquery.googleapis.com/bigquery/v2/projects/bigquery-public-data/datasets/cdc_places/tables/local_data_for_better_health_county_data",
177176
"tableReference": {
178-
"projectId": "bigquery-public-data",
179-
"datasetId": "ml_datasets",
180-
"tableId": "penguins"
177+
"projectId": "bigquery-public-data",
178+
"datasetId": "cdc_places",
179+
"tableId": "local_data_for_better_health_county_data"
181180
},
181+
"description": "Local Data for Better Health, County Data",
182182
"schema": {
183-
"fields": [
184-
{
185-
"name": "species",
186-
"type": "STRING",
187-
"mode": "REQUIRED"
188-
},
189-
{
190-
"name": "island",
191-
"type": "STRING",
192-
"mode": "NULLABLE"
193-
},
194-
{
195-
"name": "culmen_length_mm",
196-
"type": "FLOAT",
197-
"mode": "NULLABLE"
198-
},
199-
{
200-
"name": "culmen_depth_mm",
201-
"type": "FLOAT",
202-
"mode": "NULLABLE"
203-
},
204-
{
205-
"name": "flipper_length_mm",
206-
"type": "FLOAT",
207-
"mode": "NULLABLE"
208-
},
209-
{
210-
"name": "body_mass_g",
211-
"type": "FLOAT",
212-
"mode": "NULLABLE"
213-
},
214-
{
215-
"name": "sex",
216-
"type": "STRING",
217-
"mode": "NULLABLE"
218-
}
219-
]
183+
"fields": [
184+
{
185+
"name": "year",
186+
"type": "INTEGER",
187+
"mode": "NULLABLE"
188+
},
189+
{
190+
"name": "stateabbr",
191+
"type": "STRING",
192+
"mode": "NULLABLE"
193+
},
194+
{
195+
"name": "statedesc",
196+
"type": "STRING",
197+
"mode": "NULLABLE"
198+
},
199+
{
200+
"name": "locationname",
201+
"type": "STRING",
202+
"mode": "NULLABLE"
203+
},
204+
{
205+
"name": "datasource",
206+
"type": "STRING",
207+
"mode": "NULLABLE"
208+
},
209+
{
210+
"name": "category",
211+
"type": "STRING",
212+
"mode": "NULLABLE"
213+
},
214+
{
215+
"name": "measure",
216+
"type": "STRING",
217+
"mode": "NULLABLE"
218+
},
219+
{
220+
"name": "data_value_unit",
221+
"type": "STRING",
222+
"mode": "NULLABLE"
223+
},
224+
{
225+
"name": "data_value_type",
226+
"type": "STRING",
227+
"mode": "NULLABLE"
228+
},
229+
{
230+
"name": "data_value",
231+
"type": "FLOAT",
232+
"mode": "NULLABLE"
233+
}
234+
]
220235
},
221-
"numBytes": "28947",
222-
"numLongTermBytes": "28947",
223-
"numRows": "344",
224-
"creationTime": "1619804743188",
225-
"lastModifiedTime": "1634584675234",
236+
"numBytes": "234849",
237+
"numLongTermBytes": "0",
238+
"numRows": "1000",
239+
"creationTime": "1640891846119",
240+
"lastModifiedTime": "1749427268137",
226241
"type": "TABLE",
227242
"location": "US",
228-
"numTimeTravelPhysicalBytes": "0",
229-
"numTotalLogicalBytes": "28947",
230-
"numActiveLogicalBytes": "0",
231-
"numLongTermLogicalBytes": "28947",
232-
"numTotalPhysicalBytes": "5350",
233-
"numActivePhysicalBytes": "0",
234-
"numLongTermPhysicalBytes": "5350",
235-
"numCurrentPhysicalBytes": "5350"
243+
"numTimeTravelPhysicalBytes": "285737",
244+
"numTotalLogicalBytes": "234849",
245+
"numActiveLogicalBytes": "234849",
246+
"numLongTermLogicalBytes": "0",
247+
"numTotalPhysicalBytes": "326557",
248+
"numActivePhysicalBytes": "326557",
249+
"numLongTermPhysicalBytes": "0",
250+
"numCurrentPhysicalBytes": "40820"
236251
}
237252
"""
238253
try:

0 commit comments

Comments
 (0)