We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that through the BigQuery command line, it's possible to add labels to jobs / queries: https://cloud.google.com/bigquery/docs/adding-labels#adding_a_label_to_a_job
What I didn't find yet is how to set those labels through the PEP 249 DBAPI using Google's BigQuery Python library as the driver: https://cloud.google.com/python/docs/reference/bigquery/latest/dbapi
Ideally it would be possible in the creation of the DBAPI connecttion somehow
self.client = bigquery.Client( project=self.project_id, credentials=self.credentials, default_query_job_config=bigquery.QueryJobConfig( default_dataset=f"{self.project_id}.{self.dataset}", ), location=self.location, client_info=self.client_info, client_options=self.client_options, ) self.connection = dbapi.Connection(self.client)
But I didn't find that yet. Or alternatively it could possible to add the labels when executing the queries,
but that would be harder to implement i think.
Any suggestions?
The text was updated successfully, but these errors were encountered:
Hi @tombaeyens,
this is a great idea to add. Labels for queries are actually quite useful !
Could you not just pass the labels attribute to the QueryJobConfig? See https://cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery.job.QueryJobConfig#google_cloud_bigquery_job_QueryJobConfig_labels
labels
QueryJobConfig
e.g:
self.client = bigquery.Client( project=self.project_id, credentials=self.credentials, default_query_job_config=bigquery.QueryJobConfig( default_dataset=f"{self.project_id}.{self.dataset}", labels={"environemnt": "testing"} ), location=self.location, client_info=self.client_info, client_options=self.client_options, )
Sorry, something went wrong.
No branches or pull requests
It seems that through the BigQuery command line, it's possible to add labels to jobs / queries: https://cloud.google.com/bigquery/docs/adding-labels#adding_a_label_to_a_job
What I didn't find yet is how to set those labels through the PEP 249 DBAPI using Google's BigQuery Python library as the driver: https://cloud.google.com/python/docs/reference/bigquery/latest/dbapi
Ideally it would be possible in the creation of the DBAPI connecttion somehow
But I didn't find that yet. Or alternatively it could possible to add the labels when executing the queries,
but that would be harder to implement i think.
Any suggestions?
The text was updated successfully, but these errors were encountered: