Skip to main content
Version: Next

Firebase

Firebase Sink Connector

Description

The Firebase Sink Connector allows writing batch and streaming data into Google Firebase Realtime Database via its REST API. It supports writing SeaTunnel internal rows into JSON node structures and handling CDC operations (INSERT, UPDATE, DELETE).

Key Features


Options

NameTypeRequiredDefaultDescription
urlStringYes-The base URL of the Firebase Realtime Database (e.g., https://<DATABASE_NAME>.firebaseio.com).
pathStringYes-The JSON node path to write to (e.g., users or logs/2026).
service_account_pathStringNo-Path to the Google Service Account JSON key file.
credentialsStringNo-Base64-encoded Service Account JSON credentials.
database_secretStringNo-Legacy Firebase database secret key or Web API token.
timeout_msIntegerNo10000HTTP connection and read timeout in milliseconds (must be > 0).
primary_keysListNo-Field names used to identify target node key.
key_prefixStringNo-Fixed expression before key string.
key_postfixStringNo-Fixed expression after key string.
key_delimiterStringNo"_"Delimiter to concatenate values when using composite primary keys.
batch_sizeIntegerNo100Number of records aggregated before issuing a multi-location update REST payload or batch write.
retry_maxIntegerNo3Maximum retry attempts for failed HTTP write operations.
ignore_null_valuesBooleanNofalseIf true, fields with null values are omitted from the JSON payload.
support_deletesBooleanNotrueWhether to process RowKind.DELETE and RowKind.UPDATE_BEFORE records.
common-optionsConfigNo-Sink common options. Refer to Sink Common Options for details.

Data Type Mapping

The Firebase Sink connector converts SeaTunnel internal data types into JSON node structures:

SeaTunnel Data TypeFirebase / JSON Type
STRINGString
INT / BIGINTNumber (Integer)
FLOAT / DOUBLENumber (Floating point)
BOOLEANBoolean
ROW / MAPObject (Nested node)
ARRAYArray

How to Set Up

1. Authentication Options

The connector supports three authentication methods:

  • service_account_path: Point to a local service account JSON key file downloaded from Firebase Console > Project Settings > Service accounts.
  • credentials: Provide the Base64-encoded content of a service account JSON file (useful for CI/CD or cloud secret injection).
  • database_secret: Pass a legacy database secret key or Web API token.

2. Primary Key & Target Node Construction

  • Primary Keys (primary_keys): The connector uses the values from the specified primary key fields to construct the child node ID in Firebase.
  • Composite Keys: If multiple fields are provided in primary_keys, their values will be joined using key_delimiter (default: _).
  • Formatting Node Keys (key_prefix / key_postfix): Custom key prefixes and postfixes can be attached to generated keys (e.g., prefix user_ with key 101 becomes node key user_101).

Example

Writing to a Collection Node

env {
parallelism = 1
job.mode = "BATCH"
}

source {
FakeSource {
schema = {
fields {
id = "int"
name = "string"
role = "string"
}
}
rows = [
{
kind = INSERT
fields = [101, "Alice", "Admin"]
},
{
kind = INSERT
fields = [102, "Bob", "Developer"]
}
]
plugin_output = "fake_users"
}
}

sink {
Firebase {
plugin_input = "fake_users"
url = "https://my-app-default-rtdb.firebaseio.com"
path = "users"
service_account_path = "/etc/seatunnel/firebase-credentials.json"
primary_keys = ["id"]
key_prefix = "user_"
batch_size = 50
timeout_ms = 5000
}
}

Changelog

Change Log
ChangeCommitVersion
[Feature][Connector-V2] Add Firebase Source ConnectorUnreleased