Skip to content

bigfunctions > ask_my_data

ask_my_data

Signature

ask_my_data(question, fully_qualified_table)

Description

Ask your data any question in natural language.

This function calls generate_sql to convert the question into a SQL query adapted to your data and execute it.
(If the execution fails, the temporary table bigfunction_result gives details).

Param Description
question A question to ask over your data. It may start with a verb
fully_qualified_table A table whose schema will be given to the generative AI model for context.
- fully_qualified_table format must be like PROJECT.DATASET.TABLE.
- fully_qualified_table must exist.
- You must have read permission on the table schema

Examples

call bigfunctions.eu.ask_my_data('get the 3 products which generated the most revenue in 2023', 'eu.sales');
select * from bigfunction_result;
call bigfunctions.us.ask_my_data('get the 3 products which generated the most revenue in 2023', 'us.sales');
select * from bigfunction_result;
call bigfunctions.europe_west1.ask_my_data('get the 3 products which generated the most revenue in 2023', 'europe_west1.sales');
select * from bigfunction_result;

+------------+---------+
| product_id | revenue |
+------------+---------+
+ 8          + 50286   |
+ 6          + 46172   |
+ 10         + 27972   |
+------------+---------+