Connect Firebase

Firebase Firestore and Firebase Realtime Database are two source types, each with its own connection form in the Lake. Both forms are wizards with the steps General, Service account and Datetime. Use this page to add the service account key, choose the database the source reads, and see what becomes a table.

Add a Firebase source

  1. Open Lake and click Add datasource in the header, or open the New menu in the toolbar above the tree.
  2. Choose Firebase Firestore or Firebase Realtime Database in the picker. Supported connectors shows how the picker is grouped and routes each source type to its page.
  3. On General, enter a Name and a Code, and set a Folder if you want one. These fields work as on any source; see Add a data source.
  4. On Service account, add the JSON key of a service account, described below.
  5. On Datetime, choose the source Timezone and how Datetime values are read; the step also carries the summary of the new source.
  6. Click Add to save. On an existing source the button reads Save, and Duplicate makes a copy. Then import the tables you want.

The connection test is optional; it checks that the source can be reached with the key and the database settings, and it saves nothing.

Add the service account key

The Service account step starts with the key the connection runs with. The step shows this hint: "The project ID and service account email are read from the key."

The key must be the JSON key of a service account; the connection uses its project ID, client email and private key. Connector secrets covers how stored secrets behave and when the form asks for the key again.

Choose the database

Firebase Firestore

Database ID names the Firestore database to read, and its placeholder is (default). Leave the field empty for the (default) database. The note under the field reads "Leave empty for the (default) database. Each top-level collection becomes a table." Each row carries an _id column holding the Firestore document id.

Firebase Realtime Database

Database URL is the address of the database, in the form https://my-project-default-rtdb.firebaseio.com. The hint reads "Filled from the key for the default instance. Databases in other regions use https://<instance>.<region>.firebasedatabase.app - copy it from the Firebase console."

Root path picks the node to read, and its placeholder is /. The hint reads "Each child key under this path becomes a table. / = the whole database."

The form names an empty address ("Database URL is required"), and an address it cannot read as a URL reads "Enter a URL such as https://my-project-default-rtdb.firebaseio.com". Adding a key fills Database URL from the key's project ID only while the field is blank or still holds the default-instance address; an address you enter yourself is kept.

Review and save

The Datetime step also carries the summary of the new source.

Click Add to save the source; on an existing source the button reads Save, and Duplicate makes a copy. Adding a source needs Add/Modify Lake Objects, and opening a saved one needs View Lake Objects. See Who can do what in the Lake.

When you edit a saved source, the form opens on the Service account step, and Name and Code are locked.

Loads and syncs

Questions, answered

Which Firebase source should I choose?

The one that matches where the data lives: Firebase Firestore for a Firestore database, Firebase Realtime Database for a Realtime Database. Both forms use the same steps and share the key handling, and they differ only in the database settings described above.

What do I enter in Database ID?

Leave it empty for the (default) database, or enter the ID of the database to read. Each top-level collection of the database becomes a table, and each row carries an _id column holding the Firestore document id.

What becomes a table in Firebase Realtime Database?

Each child key under the Root path becomes a table. The default path, /, means the whole database.

How do I read a database in another region?

The key points Database URL at the default instance of the project. A database in another region has its own address, in the form https://<instance>.<region>.firebasedatabase.app; copy it from the Firebase console into Database URL.

Why did Database URL fill itself in?

Adding the key fills the field from the key's project ID, but only while the field is blank or still holds the default-instance address. An address you enter yourself is kept.

Why must I enter the key again after I change the Database URL?

Database URL counts as an identity field of the connection. If your administrator turned on the secret re-entry setting in System settings, changing it clears the stored key and the form asks for it again: "The database URL changed. Enter the service account key again." The setting is off by default.

How are datetime values read from a Firebase source?

The Datetime step works as on other sources: choose the Timezone the source writes values in and how Datetime values are read, or apply the suggestion when the connection test detected a timezone. Timezones and datetime values explains the choices and the rules that always apply.

Does an incremental Firestore load read the whole collection?

No. Firestore bills for every document read, so an incremental load sends its window into the request to Firestore instead of reading everything. The request covers the window widened by one day on each side, and the exact window is applied again when the rows land.

Can a Realtime Database load narrow the read to a date window?

No. The load reads the data and applies the window when the rows land. For an incremental sync the increment column must be a datetime: a Realtime Database timestamp is read as a number when the source is sampled, so set its Data Type to a datetime first (Set up a table's columns).

What opens when I edit a saved Firebase source?

The same form, filled from the saved connection, and it opens on the Service account step. Name and Code are locked in edit mode, and the stored key sits on its card, where Replace adds a new one. Click Save once you have changed something.

Why did a run fail with "Cannot find table key for ..."?

The load could not find the table it was set up for, and the run stops with "Cannot find table key for Firestore table: …" or "Cannot find table key for Realtime Database table: …". Check that the table still exists in the source, then run the load again. Lake troubleshooting shows where a failed run keeps its full error text.