Skip to content

Commit 94d8210

Browse files
committed
Return only leaf field names in the record fields and don't recurse into REPEATED fields
1 parent db3f3a2 commit 94d8210

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pybigquery/sqlalchemy_bigquery.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,16 @@ def _get_columns_helper(self, columns, cur_columns):
240240
"""
241241
results = []
242242
for col in columns:
243-
if col.field_type == 'RECORD':
243+
if col.field_type == 'RECORD' and col.mode != 'REPEATED':
244244
cur_columns.append(col)
245245
results += self._get_columns_helper(col.fields, cur_columns)
246246
cur_columns.pop()
247-
248-
results += [SchemaField(name='.'.join(col.name for col in cur_columns + [col]),
249-
field_type=col.field_type,
250-
mode=col.mode,
251-
description=col.description,
252-
fields=col.fields)]
247+
else:
248+
results += [SchemaField(name='.'.join(col.name for col in cur_columns + [col]),
249+
field_type=col.field_type,
250+
mode=col.mode,
251+
description=col.description,
252+
fields=col.fields)]
253253
return results
254254

255255
def get_columns(self, connection, table_name, schema=None, **kw):

0 commit comments

Comments
 (0)