fix(fs-bq-import-collection): so it respects existing firestore-bigquery-export BigQuery configuration during backfill#2785
Open
IzaakGough wants to merge 6 commits intonextfrom
Open
fix(fs-bq-import-collection): so it respects existing firestore-bigquery-export BigQuery configuration during backfill#2785IzaakGough wants to merge 6 commits intonextfrom
IzaakGough wants to merge 6 commits intonextfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for clustering and materialized views in the BigQuery export import script. Key changes include updating the CLI to accept --view-type and --clustering options, refining the tableRequiresUpdate logic to handle metadata explicitly, and switching to .some() for column existence checks. Feedback focuses on ensuring these new options are supported in the interactive setup path, cleaning up commented-out imports, improving type safety in the parseClustering function, and correcting a typo in the CLI help text.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…seClustering return type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
fs-bq-import-collectionso it respects existingfirestore-bigquery-exportBigQuery configuration during backfill.The import script was not passing view/clustering settings into
FirestoreBigQueryEventHistoryTracker, which caused problems when importing into an extension deployment using materialized latest views and clustering. In that state, the import path could treat *_raw_latest as a standard view and could also trigger unnecessary changelog metadata updates.This PR:
Problem
For an extension configured with:
VIEW_TYPE=materialized_incrementalCLUSTERING=timestampthe import script did not initialize the change tracker with equivalent settings. That meant the backfill path could diverge from the deployed extension’s BigQuery resource configuration.
In practice this caused two issues:
Changes
Add --view-type and --clustering options to the import CLI
Parse and return
viewTypeandclusteringfrom both:- non-interactive mode
- interactive prompt mode
Pass the following into
FirestoreBigQueryEventHistoryTracker:-
clustering-
useMaterializedView-
useIncrementalMaterializedViewFix changelog update detection by:
- comparing against fresh
table.getMetadata()results rather thantable.metadata- using boolean field existence checks instead of find() return values
Validation
Validated locally against an existing extension-managed dataset configured with:
VIEW_TYPE=materialized_incrementalclustering=timestampObserved behavior after this change:
*_raw_latestmaterialized view is recognized and skipped when config matchesNotes
There is still a log line from clustering initialization that can read as if clustering was updated even when no metadata write occurs. In the verified flow, that appears to be a logging artifact rather than an actual BigQuery table update.