add configurable write_mode to BigQueryIOManager#32998
Conversation
Added support for truncate, replace, and append modes to allow schema evolution and append-only workflows. Includes unit tests and documentation updates.
|
@michalcabir-ui I unblocked our CI tests (and we're looking into getting them to launch automatically for you), but I can't tell if you're able to see the results-- are you able to click through into the failing buildkite/unit-tests? |
I fixed the remarks but now i can`t run it again or see the logs for the new CI build |
|
@michalcabir-ui I unblocked and see some more CI issues-- FWIW we are working on a solution where a Dagster employee won't need to manually unblock each time for you. |
neverett
left a comment
There was a problem hiding this comment.
Left a few suggestions on the docs changes, will leave final review and approval to @smackesey
style fix Co-authored-by: Nikki Everett <neverett@users.noreply.github.com>
…ith-dagster.md style fix Co-authored-by: Nikki Everett <neverett@users.noreply.github.com>
|
@michalcabir-ui Still seeing a bunch of failing bigquery-related tests, pls have a look. Sorry for the slow iteration with the tests here, we are working on improving this process. In the meantime, I'll keep this top of queue continually unblocking till we land it. |
Hi, I fixed the Pyright errors, pass credentials to Spark client, and fix prettier formatting. |
Summary & Motivation
Added a configurable write_mode option to BigQueryIOManager to support schema evolution and different writing strategies for non-partitioned tables.
Currently, the IO manager forces a TRUNCATE operation, which deletes rows but preserves the schema. This causes failures when the DataFrame schema changes (e.g., adding/removing columns).
How I Tested These Changes
Unit Testing: Created a new test file dagster_gcp_tests/bigquery_tests/test_bigquery_write_modes.py using unittest.mock.
Verified that write_mode="truncate" triggers a TRUNCATE TABLE query.
Verified that write_mode="replace" triggers a DROP TABLE IF EXISTS query.
Verified that write_mode="append" triggers no cleanup query.
Verified that partitioned tables ignore the write mode and use the legacy DELETE FROM logic.
Added a factory test to ensure the BigQueryClient is initialized with the correct default write_mode for backward compatibility.
Changelog
feat(gcp): Add write_mode configuration to BigQueryIOManager (supports truncate, replace, append) to allow schema evolution and append-only workflows.