-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add partition support to BigQuery #2058
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
Conversation
partitioned = None | ||
if "timePartitioning" in self._properties: | ||
partitioned = self._properties.get('timePartitioning').get('type') | ||
return partitioned |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
The docs for creating partitioned tables point to a query for listing partitions, Could we use that to implement `table.list_partitions'? |
with self.assertRaises(ValueError): | ||
table.partitioning_type = "HASH" | ||
with self.assertRaises(ValueError): | ||
table.partition_expiration = "NEVER" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Thank you for the patch! |
I've got a method I didn't include for list_partitions that does generate and run that query. What I'm not sure about is the best way to fake a partitioned table for testing said method. |
Assuming the method looks something like: def list_partitions(self):
query = self._client.query(
'SELECT partition_id from [%s.%s$__PARTITIONS_SUMMARY__]' %
(self.dataset_name, self.name))
query.run()
return [row[0] for row in query.rows] I think I would just mock up the |
This adds the ability to create a partitioned table. It would be nice to expose a table.list_partitions() method, but currently there is not an API-based way of returning partitions. So, for now, it simply allows users to interact with the current partitioning API.