Allow querying the bigframes dataframe with custom BigQuery SQL like pandasql #647
Labels
api: bigquery
Issues related to the googleapis/python-bigquery-dataframes API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Feature Request
Supposed I used bigframes and processed my data like this:
res_df = df.assign(pred=input_remote_function.apply(generate_text))
And got this output dataframe res_df:
As you can see, the pred column is a JSON string.
Describe the solution you'd like
I would like to use BigQuery JSON Functions to explode this column into a column for each JSON attribute.
For example, I could write a custom BigQuery SQL code to run for this dataframe, like this:
res_df = df.sqldf("SELECT *, JSON_EXTRACT(pred, '$.interpretation') AS interpretation FROM df")
Getting as a result the res_df:
Describe alternatives you've considered
As an alternative I need to use remote functions, like this one, to explode the column:
Which I cannot pass multiple parameter because of #646
Additional context
The pandasql allow us to query pandas DataFrames using SQL syntax.
Bigframes supporting, pushing down the query to BQ would be helpful.
https://pypi.org/project/pandasql/
The text was updated successfully, but these errors were encountered: