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

BigQuery: Allow subset of schema to be passed into load_table_from_dataframe. #9064

Merged
merged 9 commits into from
Aug 22, 2019
8 changes: 4 additions & 4 deletions bigquery/google/cloud/bigquery/_pandas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def dataframe_to_bq_schema(dataframe, bq_schema):
type for some or all of the DataFrame columns.

Returns:
Sequence[google.cloud.bigquery.schema.SchemaField]:
The automatically determined schema. Returns empty tuple if the
type of any column cannot be determined.
Optional[Sequence[google.cloud.bigquery.schema.SchemaField]]:
The automatically determined schema. Returns None if the type of
any column cannot be determined.
"""
if bq_schema:
for field in bq_schema:
Expand All @@ -227,7 +227,7 @@ def dataframe_to_bq_schema(dataframe, bq_schema):
bq_type = _PANDAS_DTYPE_TO_BQ.get(dtype.name)
if not bq_type:
warnings.warn("Unable to determine type of column '{}'.".format(column))
return ()
return None
plamut marked this conversation as resolved.
Show resolved Hide resolved
bq_field = schema.SchemaField(column, bq_type)
bq_schema_out.append(bq_field)
return tuple(bq_schema_out)
Expand Down