[go: nahoru, domu]

Skip to content
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

feat(firestore-bigquery-export): new param EXCLUDE_OLD_DATA to reduce CloudTask payload size #1908

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions firestore-bigquery-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ essential for the script to insert data into an already partitioned table.)

* Use new query syntax for snapshots: If enabled, snapshots will be generated with the new query syntax, which should be more performant, and avoid potential resource limitations.

* Exclude old data payloads: If enabled, table rows will never contain old data (document snapshot before the update), which should be more performant, and avoid potential resource limitations.

* Import existing Firestore documents into BigQuery?: Do you want to import existing documents from your Firestore collection into BigQuery? These documents will have each have a special changelog with the operation of `IMPORT` and the timestamp of epoch. This ensures that any operation on an imported document supersedes the import record.

* Existing Documents Collection: Specify the path of the Cloud Firestore Collection you would like to import from. This may or may not be the same Collection for which you plan to mirror changes. If you want to use a collectionGroup query, provide the collection name value here, and set 'Use Collection Group query' to true. You may use `{wildcard}` notation with an enabled collectionGroup query to match a subcollection of all documents in a collection (e.g., `chatrooms/{chatid}/posts`).
Expand Down
8 changes: 8 additions & 0 deletions firestore-bigquery-export/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ params:
default: no
required: true

- param: EXCLUDE_OLD_DATA
label: Exclude old data payloads
description: >-
If enabled, table rows will never contain old data (document snapshot
before the update), which should be more performant, and avoid potential
resource limitations.
type: select

- param: DO_BACKFILL
label: Import existing Firestore documents into BigQuery?
description: >-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Object {
"datasetLocation": undefined,
"doBackfill": false,
"docsPerBackfill": 200,
"excludeOldData": false,
"importCollectionPath": undefined,
"initialized": false,
"instanceId": undefined,
Expand Down
1 change: 1 addition & 0 deletions firestore-bigquery-export/functions/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default {
wildcardIds: process.env.WILDCARD_IDS === "true",
useNewSnapshotQuerySyntax:
process.env.USE_NEW_SNAPSHOT_QUERY_SYNTAX === "yes" ? true : false,
excludeOldData: process.env.EXCLUDE_OLD_DATA === "yes" ? true : false,
instanceId: process.env.EXT_INSTANCE_ID!,
maxDispatchesPerSecond: parseInt(
process.env.MAX_DISPATCHES_PER_SECOND || "10"
Expand Down
3 changes: 2 additions & 1 deletion firestore-bigquery-export/functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ export const fsexportbigquery = functions
const isDeleted = changeType === ChangeType.DELETE;

const data = isDeleted ? undefined : change.after.data();
const oldData = isCreated ? undefined : change.before.data();
const oldData =
isCreated || config.excludeOldData ? undefined : change.before.data();

await events.recordStartEvent({
documentId,
Expand Down
Loading