Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: undocumented use of raw_sql and parameters maybe a bug in BigQuery con #10861

Closed
1 task done
dgarridoa opened this issue Feb 19, 2025 · 1 comment · Fixed by #10874
Closed
1 task done

docs: undocumented use of raw_sql and parameters maybe a bug in BigQuery con #10861

dgarridoa opened this issue Feb 19, 2025 · 1 comment · Fixed by #10874
Labels
docs Documentation related issues or PRs

Comments

@dgarridoa
Copy link

dgarridoa commented Feb 19, 2025

Please describe the issue

Reading the docs and the code I am not sure what is the proper way to use query parameters in con.raw_sql. For instance, lets say that i want to perform a parameterized delete operation as follows:

import ibis
import ibis.expr.datatypes as dt

# ex: to bigquery
con = ...
cutoff = ibis.param("date")
query_parameters = {cutoff: date(2024, 10, 28)}
query = f"DELETE FROM dataset.table WHERE cutoff = @{cutoff.get_name()}"
con.raw_sql(query, params=query_parameters)

This approach kind of beat the purpose of using query parameters, because I have to pass the parameter name through string formatting. By the way ibis.param("date").name("cutoff") does not work, because param.op() is instance of Alias, therefore param.op().arg.name is used instead.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dgarridoa dgarridoa added the docs Documentation related issues or PRs label Feb 19, 2025
@dgarridoa dgarridoa changed the title docs: undocumented use of raw_sql and parameters maybe a bug in BigQuery docs: undocumented use of raw_sql and parameters maybe a bug in BigQuery con Feb 19, 2025
@cpcloud
Copy link
Member

cpcloud commented Feb 20, 2025

Thanks for the report. I'll investigate. We may not need to fiddle with Alias unwrapping here anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation related issues or PRs
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants