Skip to content

BigQuery: Determine the schema in load_table_from_dataframe based on dtypes. - #9049

Merged
tswast merged 5 commits into
googleapis:masterfrom
tswast:issue8140-schema-subset
Aug 21, 2019
Merged

BigQuery: Determine the schema in load_table_from_dataframe based on dtypes.#9049
tswast merged 5 commits into
googleapis:masterfrom
tswast:issue8140-schema-subset

Conversation

@tswast

Copy link
Copy Markdown
Contributor

This PR updates load_table_from_dataframe to automatically determine
the BigQuery schema based on the DataFrame's dtypes. If any field's type
cannot be determined, fallback to the logic in the pandas to_parquet
method.

Closes#9044

@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 16, 2019
@tswasttswast changed the title Determine the schema in load_table_from_dataframe based on dtypes.BigQuery: Determine the schema in load_table_from_dataframe based on dtypes.Aug 16, 2019
@tswasttswast added the api: bigquery Issues related to the BigQuery API. label Aug 16, 2019
This PR updates `load_table_from_dataframe` to automatically determine
the BigQuery schema based on the DataFrame's dtypes. If any field's type
cannot be determined, fallback to the logic in the pandas `to_parquet`
method.
@tswast
tswastforce-pushed the issue8140-schema-subset branch from 16945d5 to a6126b7CompareAugust 20, 2019 21:42
@tswast
tswast marked this pull request as ready for review August 20, 2019 21:43
@tswast
tswast requested review from a team and plamutAugust 20, 2019 21:43

@plamutplamut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's just shorten the fixture in the system test.

Comment threadbigquery/tests/system.py
@tswast
tswast requested a review from plamutAugust 21, 2019 17:45

@plamutplamut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tswast
tswast merged commit fcf99ce into googleapis:masterAug 21, 2019
@tswast
tswast deleted the issue8140-schema-subset branch August 21, 2019 18:30
HemangChothani pushed a commit to HemangChothani/google-cloud-python that referenced this pull request Aug 29, 2019
…oogleapis#9049)
* Determine the schema in `load_table_from_dataframe` based on dtypes.
This PR updates `load_table_from_dataframe` to automatically determine
the BigQuery schema based on the DataFrame's dtypes. If any field's type
cannot be determined, fallback to the logic in the pandas `to_parquet`
method.
* Fix test coverage.
* Reduce duplication by using OrderedDict
* Add columns option to DataFrame constructor to ensure correct column order.
emar-kar pushed a commit to MaxxleLLC/google-cloud-python that referenced this pull request Sep 18, 2019
…oogleapis#9049)
* Determine the schema in `load_table_from_dataframe` based on dtypes.
This PR updates `load_table_from_dataframe` to automatically determine
the BigQuery schema based on the DataFrame's dtypes. If any field's type
cannot be determined, fallback to the logic in the pandas `to_parquet`
method.
* Fix test coverage.
* Reduce duplication by using OrderedDict
* Add columns option to DataFrame constructor to ensure correct column order.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigqueryIssues related to the BigQuery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BigQuery: load_table_from_dataframe automatically generate schema for known dtypes

3 participants

@tswast@plamut@googlebot