-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
modified schema field list #13087
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
modified schema field list #13087
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -477,11 +477,17 @@ def verify_schema(self, dataset_id, table_id, schema): | |
| from apiclient.errors import HttpError | ||
| | ||
| try: | ||
| return (self.service.tables().get( | ||
| remote_schema = self.service.tables().get( | ||
| projectId=self.project_id, | ||
| datasetId=dataset_id, | ||
| tableId=table_id | ||
| ).execute()['schema']) == schema | ||
| ).execute()['schema'] | ||
| | ||
| modified_schema_field_list = [ | ||
| {key: field[key] for key in field if key != 'description'} | ||
| ||
| for field in remote_schema['fields']] | ||
| | ||
| return {'fields': modified_schema_field_list} == schema | ||
| | ||
| except HttpError as ex: | ||
| self.process_http_error(ex) | ||
| | @@ -717,7 +723,11 @@ def to_gbq(dataframe, destination_table, project_id, chunksize=10000, | |
| raise InvalidSchema("Please verify that the column order, " | ||
| "structure and data types in the " | ||
| "DataFrame match the schema of the " | ||
| "destination table.") | ||
| "destination table. All columns in the " | ||
| "destination table must be NULLABLE. " | ||
| "To change REQUIRED columns to NULLABLE, " | ||
| "see https://cloud.google.com/bigquery/" | ||
| "docs/tables#updateschema") | ||
| else: | ||
| table.create(table_id, table_schema) | ||
| | ||
| | @@ -756,7 +766,8 @@ def _generate_bq_schema(df, default_type='STRING'): | |
| fields = [] | ||
| for column_name, dtype in df.dtypes.iteritems(): | ||
| fields.append({'name': column_name, | ||
| 'type': type_mapping.get(dtype.kind, default_type)}) | ||
| 'type': type_mapping.get(dtype.kind, default_type), | ||
| 'mode': 'NULLABLE'}) | ||
| | ||
| return {'fields': fields} | ||
| | ||
| | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move to 0.19.2