You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Prior versions of google-cloud-bigquery (2.3.1) allowed SchemaField instantiation based on an existing SchemaField__repr__.
Use Case
System generates list of SchemaField and passes it through a Jinja template as part of building hundreds of Airflow DAGs.
Jinja prints __repr__ from the SchemaField into the templated .py.
Airflow picks up the .py files and executes them.
Execution results in the below error.
Code example
In version 2.3.1
from google.cloud.bigquery import SchemaField
from google.cloud import bigquery
bigquery.__version__
'2.3.1'
# This works
field = SchemaField('name', 'STRING', 'REQUIRED', 'Name')
field.__repr__()
"SchemaField('name', 'STRING', 'REQUIRED', 'Name', (), ())"
# Jinja prints ^^ to a .py file
# When the file is executed the SchemaField is created without issue
Version 2.29.0:
from google.cloud.bigquery import SchemaField
from google.cloud import bigquery
bigquery.__version__
'2.29.0'
# This raises an error for the tuple in the last field
field = SchemaField('name', 'STRING', 'REQUIRED', 'Name')
field.__repr__()
"SchemaField('name', 'STRING', 'REQUIRED', 'Name', (), ())"
# Jinja prints ^^ to a .py file
# When the file is executed, an error is raised:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/wes.roach/.pyenv/versions/upgr-dbt/lib/python3.9/site-packages/google/cloud/bigquery/schema.py", line 125, in __init__
policy_tags.to_api_repr() if policy_tags is not None else None
AttributeError: 'tuple' object has no attribute 'to_api_repr'
Setting the policy_tags to None still results in ().
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
tswast commentedon Nov 2, 2021
@WesRoach Thanks for the report! This does appear to be a bug introduced when policy tags were added.
tswast commentedon Nov 2, 2021
@plamut Potential project for you if you have cycles? It'd be good to get this in v2.
plamut commentedon Nov 3, 2021
@tswast I'll take a look, yes.
plamut commentedon Nov 4, 2021
Confirmed, the regression was caused by #983.