move-coop / parsons

A python library of connectors for the progressive community.
Other
255 stars 125 forks source link

Enable parameterization of bigquery queries #947

Closed austinweisgrau closed 7 months ago

austinweisgrau commented 7 months ago

Addresses https://github.com/move-coop/parsons/issues/929

Documentation on BigQuery query parameterization was wrong, but also with the existing implementation of the query method, parameterization was not possible.

Updates are made to enable parameterization of queries using the bigquery client, and documentation is updated to reflect correct usage.

BigQuery python query parameterization requires the use of client.query() rather than a more generic database connection & cursor.

See documentation here: https://cloud.google.com/bigquery/docs/parameterized-queries

This PR replaces #931 to make these updates on top of the major-release branch version of the bigquery client, rather than main.

TODO:

austinweisgrau commented 7 months ago

My bad! This was not an issue, I was wrong. I closed #931 and I'm closing this out too.

The change made here works more closely with the BigQuery preferred python interaction, but I'm perfectly happy with and support the choices made in favor of database interoperability.