-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: replaces table.update() and table.patch() with client.update_table() #4076
Conversation
resource['description'] = self.description | ||
|
||
if self.expires is not None: | ||
if self.expires is not None and fields == [] or 'expires' in fields: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
||
if self._schema: | ||
if ( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
bigquery/tests/unit/test_client.py
Outdated
@@ -830,7 +830,7 @@ def test_update_table_w_schema_None(self): | |||
'projectId': project, | |||
'datasetId': dataset_id, | |||
'tableId': table_id}, | |||
'schema': {'fields': []} | |||
'schema': [] |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
resource['view']['query'] = self.view_query | ||
|
||
def _populate_schema_resource(self, resource): | ||
if len(self._schema) == 0: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
client = self._make_one(project=project, credentials=creds) | ||
conn = client._connection = _Connection(resource) | ||
table_ref = client.dataset(dataset_id).table(table_id) | ||
table = Table(table_ref, schema=schema, client=client) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -616,41 +619,58 @@ def _set_properties(self, api_response): | |||
cleaned['expirationTime'] = float(cleaned['expirationTime']) | |||
self._properties.update(cleaned) | |||
|
|||
def _build_resource(self): | |||
def _populate_expires_resource(self, resource): | |||
value = _millis_from_datetime(self.expires) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
'fields': _build_schema_resource(self._schema) | ||
} | ||
|
||
custom_resource_fields = { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
'partitioning_type', 'view_use_legacy_sql', 'view_query', 'schema' | ||
] | ||
for f in all_fields: | ||
if filter_fields and f not in filter_fields: |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
custom_resource_fields[f](resource) | ||
else: | ||
# snake case to camel case | ||
words = f.split('_') |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
'view_use_legacy_sql': self._populate_view_use_legacy_sql_resource, | ||
'schema': self._populate_schema_resource | ||
} | ||
all_fields = [ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
43611f4
to
19af93a
Compare
…e_table() (#4076) * adds client.update_table() * removes table.update() and table.patch() * adds coverage for _verifyResourceProperties() * adds test for deleting property and refactors table resource creation * fixes update_table tests * Fixes logic in _build_resource()
…e_table() (#4076) * adds client.update_table() * removes table.update() and table.patch() * adds coverage for _verifyResourceProperties() * adds test for deleting property and refactors table resource creation * fixes update_table tests * Fixes logic in _build_resource()
No description provided.