Commit c2c2958
authored
feat: allow to set clustering and time partitioning options at table creation (#928)
* refactor: standardize bigquery options handling to manage more options
* feat: handle table partitioning, table clustering and more table options (expiration_timestamp, expiration_timestamp, require_partition_filter, default_rounding_mode) via create_table dialect options
* fix: having clustering fields and partitioning exposed has table indexes leads to bad autogenerated version file
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('clustering', table_name='dataset.some_table')
op.drop_index('partition', table_name='dataset.some_table')
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_index('partition', 'dataset.some_table', ['createdAt'], unique=False)
op.create_index('clustering', 'dataset.some_table', ['id', 'createdAt'], unique=False)
# ### end Alembic commands ###
* docs: update README to describe how to create clustered and partitioned table as well as other newly supported table options
* test: adjust system tests since indexes are no longer populated from table partitions and clustering info
* test: alembic now supports creating partitioned tables
* test: run integration tests with all the new create_table options
* chore: rename variables to represent what it is a bit more clearly
* fix: assertions should no be used to validate user inputs
* refactor: extract process_option_value() from post_create_table() for improved readability
* docs: add docstring to post_create_table() and _process_option_value()
* test: increase code coverage by testing error cases
* refactor: better represent the distinction between the option value data type check and the transformation in SQL literal
* test: adding test cases for _validate_option_value_type() and _process_option_value()
* chore: coding style
* chore: reformat files with black
* test: typo in tests
* feat: change the option name for partitioning to leverage the TimePartitioning interface of the Python Client for Google BigQuery
* fix: TimePartitioning.field is optional
* chore: coding style
* test: fix system test with table option bigquery_require_partition_filter
* feat: add support for experimental range_partitioning option
* test: fix system test with new bigquery_time_partitioning table option
* docs: update README with time_partitioning and range_partitioning
* test: relevant comments in unit tests
* test: cover all error cases
* chore: no magic numbers
* chore: consistency in docstrings
* chore: no magic number
* chore: better error types
* chore: fix W605 invalid escape sequence1 parent ac74a34 commit c2c2958
File tree
7 files changed
+799
-67
lines changed- sqlalchemy_bigquery
- tests
- system
- unit
7 files changed
+799
-67
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
296 | 301 | | |
297 | 302 | | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
301 | 306 | | |
302 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
303 | 354 | | |
304 | 355 | | |
305 | 356 | | |
| |||
0 commit comments