Skip to content

Commit

Permalink
Merge branch next into fix-storage-preinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
i14h committed Dec 11, 2024
2 parents 4a05023 + f87b847 commit 9404102
Show file tree
Hide file tree
Showing 46 changed files with 6,054 additions and 2,064 deletions.
8 changes: 8 additions & 0 deletions _emulator/.firebaserc
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"projects": {
"default": "demo-test"
},
"targets": {},
"etags": {
"dev-extensions-testing": {
"extensionInstances": {
"firestore-bigquery-export": "02acbd8b443b9635716d52d65758a78db1e51140191caecaaf60d932d314a62a"
}
}
}
}
24 changes: 24 additions & 0 deletions firestore-bigquery-export/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## Version 0.1.56

feat - improve sync strategy by immediately writing to BQ, and using cloud tasks only as a last resort

refactor - improve observability/logging of events

chore - remove legacy backfill code

fix - improved usage of the types from change tracker package

feat - remove log failed exports param

## Version 0.1.55

feat - log failed queued tasks

## Version 0.1.54

fixed - bump changetracker and fix more vulnerabilities

## Version 0.1.53

fixed - bump changetracker to fix npm vulnerabilities

## Version 0.1.52

fixed - bump changetracker to fix npm vulnerabilities
Expand Down
6 changes: 2 additions & 4 deletions firestore-bigquery-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,16 @@ essential for the script to insert data into an already partitioned table.)

* Exclude old data payloads: If enabled, table rows will never contain old data (document snapshot before the Firestore onDocumentUpdate event: `change.before.data()`). The reduction in data should be more performant, and avoid potential resource limitations.

* Use Collection Group query: Do you want to use a [collection group](https://firebase.google.com/docs/firestore/query-data/queries#collection-group-query) query for importing existing documents? You have to enable collectionGroup query if your import path contains subcollections. Warning: A collectionGroup query will target every collection in your Firestore project that matches the 'Existing documents collection'. For example, if you have 10,000 documents with a subcollection named: landmarks, this will query every document in 10,000 landmarks collections.

* Cloud KMS key name: Instead of Google managing the key encryption keys that protect your data, you control and manage key encryption keys in Cloud KMS. If this parameter is set, the extension will specify the KMS key name when creating the BQ table. See the PREINSTALL.md for more details.

* Maximum number of enqueue attempts: This parameter will set the maximum number of attempts to enqueue a document to cloud tasks for export to BigQuery.



**Cloud Functions:**

* **fsexportbigquery:** Listens for document changes in your specified Cloud Firestore collection, then exports the changes into BigQuery.

* **fsimportexistingdocs:** Imports existing documents from the specified collection into BigQuery. Imported documents will have a special changelog with the operation of `IMPORT` and the timestamp of epoch.

* **syncBigQuery:** A task-triggered function that gets called on BigQuery sync

* **initBigQuerySync:** Runs configuration for sycning with BigQuery
Expand Down
93 changes: 11 additions & 82 deletions firestore-bigquery-export/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

name: firestore-bigquery-export
version: 0.1.52
version: 0.1.56
specVersion: v1beta

displayName: Stream Firestore to BigQuery
Expand Down Expand Up @@ -60,19 +60,6 @@ resources:
eventType: providers/cloud.firestore/eventTypes/document.write
resource: projects/${param:PROJECT_ID}/databases/(default)/documents/${param:COLLECTION_PATH}/{documentId}

- name: fsimportexistingdocs
type: firebaseextensions.v1beta.function
description:
Imports existing documents from the specified collection into BigQuery.
Imported documents will have a special changelog with the operation of
`IMPORT` and the timestamp of epoch.
properties:
runtime: nodejs18
taskQueueTrigger:
retryConfig:
maxAttempts: 15
minBackoffSeconds: 60

- name: syncBigQuery
type: firebaseextensions.v1beta.function
description: >-
Expand Down Expand Up @@ -396,74 +383,6 @@ params:
- label: No
value: no

# - param: DO_BACKFILL
# label: Import existing Firestore documents into BigQuery?
# description: >-
# 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.
# type: select
# required: true
# default: no
# options:
# - label: Yes
# value: yes
# - label: No
# value: no

# - param: IMPORT_COLLECTION_PATH
# label: Existing Documents Collection
# description: >-
# 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`).
# type: string
# validationRegex: "^[^/]+(/[^/]+/[^/]+)*$"
# validationErrorMessage:
# Firestore collection paths must be an odd number of segments separated by
# slashes, e.g. "path/to/collection".
# example: posts
# required: false

- param: USE_COLLECTION_GROUP_QUERY
label: Use Collection Group query
description: >-
Do you want to use a [collection
group](https://firebase.google.com/docs/firestore/query-data/queries#collection-group-query)
query for importing existing documents? You have to enable collectionGroup
query if your import path contains subcollections. Warning: A
collectionGroup query will target every collection in your Firestore
project that matches the 'Existing documents collection'. For example, if
you have 10,000 documents with a subcollection named: landmarks, this will
query every document in 10,000 landmarks collections.
type: select
default: no
options:
- label: Yes
value: yes
- label: No
value: no

# - param: DOCS_PER_BACKFILL
# label: Docs per backfill
# description: >-
# When importing existing documents, how many should be imported at once?
# The default value of 200 should be ok for most users. If you are using a
# transform function or have very large documents, you may need to set this
# to a lower number. If the lifecycle event function times out, lower this
# value.
# type: string
# example: 200
# validationRegex: "^[1-9][0-9]*$"
# validationErrorMessage: Must be a postive integer.
# default: 200
# required: true

- param: KMS_KEY_NAME
label: Cloud KMS key name
description: >-
Expand All @@ -478,6 +397,16 @@ params:
'projects/PROJECT_NAME/locations/KEY_RING_LOCATION/keyRings/KEY_RING_ID/cryptoKeys/KEY_ID'.
required: false

- param: MAX_ENQUEUE_ATTEMPTS
label: Maximum number of enqueue attempts
description: >-
This parameter will set the maximum number of attempts to enqueue a
document to cloud tasks for export to BigQuery.
type: string
validationRegex: ^(10|[1-9])$
validationErrorMessage: Please select an integer between 1 and 10
default: 3

events:
- type: firebase.extensions.firestore-counter.v1.onStart
description:
Expand Down
Loading

0 comments on commit 9404102

Please sign in to comment.