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: Determine the schema in load_table_from_dataframe based on dtypes. #9049

Merged
merged 5 commits into from Aug 21, 2019

Conversation

tswast
Copy link
Contributor

@tswast tswast commented 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.

Closes #9044

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 16, 2019
@tswast tswast 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
@tswast tswast 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 tswast marked this pull request as ready for review August 20, 2019 21:43
@tswast tswast requested review from a team and plamut August 20, 2019 21:43
Copy link
Contributor

@plamut plamut left a comment

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.

bigquery/tests/system.py Outdated Show resolved Hide resolved
@tswast tswast requested a review from plamut August 21, 2019 17:45
Copy link
Contributor

@plamut plamut left a comment

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:master Aug 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This 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