Skip to content

Engine Configuration

The engine configuration controls how Bizon stores state, passes messages between pipeline stages, and executes workloads. Everything on this page lives under the top-level engine: key.

engine:
backend:
type: postgres
config:
host: localhost
port: 5432
database: bizon
schema: public
username: bizon
password: env://POSTGRES_PASSWORD
queue:
type: python_queue
config:
max_nb_messages: 1000000
runner:
type: thread
config:
max_workers: 2
log_level: INFO

Every section is optional. Without engine:, Bizon uses a local SQLite backend, an unbounded python_queue and the thread runner.

Backends store pipeline state: jobs, cursors for recovery, incremental state and pending stream resets.

TypeUse CasePersistence
sqliteDevelopmentFile <database>.sqlite3 in the working directory
sqlite_in_memoryTestingNone
postgresProductionFull
bigqueryServerless productionFull

Every backend has a type and a config block. These keys go inside config:

FieldTypeDefaultDescription
databasestringRequiredDatabase name. For BigQuery, the GCP project
schemastringRequiredSchema name. For BigQuery, the dataset
syncCursorInDBEveryint10Write the cursor to the backend every N iterations
echoEngineboolfalseLog the SQL issued by SQLAlchemy

Stores state in bizon.sqlite3 in the working directory. schema is required but not used.

engine:
backend:
type: sqlite
config:
database: bizon
schema: public

No persistence, useful for unit tests:

engine:
backend:
type: sqlite_in_memory
config:
database: bizon
schema: public
engine:
backend:
type: postgres
config:
host: localhost
port: 5432
database: bizon
schema: public
username: bizon_user
password: gsm://bizon-postgres-password
FieldTypeDescription
hoststringDatabase host
portintDatabase port
usernamestringDatabase user
passwordstringDatabase password. Use a secret reference

The state tables are created in the connection’s search_path. Install the postgres extra: pip install 'bizon[postgres]'.

Stores state in BigQuery tables:

engine:
backend:
type: bigquery
config:
database: my-project
schema: bizon_state
create_schema: true
schema_location: EU
FieldTypeDefaultDescription
databasestringRequiredGCP project
schemastringRequiredDataset holding the state tables
create_schemaboolfalseCreate the dataset if it doesn’t exist. When false, a missing dataset fails the run with an error naming this flag
schema_locationstringNoneLocation of the dataset when it is created (US, EU, europe-west1, …), and of the backend’s query jobs. Unset keeps BigQuery’s default
service_account_keystring""Ignored, with a warning. The backend authenticates with Application Default Credentials

BigQuery cannot move a dataset after it is created, so set schema_location before the first run.

The backend often shares its dataset with a BigQuery destination. When database and schema match the destination’s project_id and dataset_id:

  • create_dataset: true on the destination requires create_schema: true on the backend, because the backend checks the dataset before the destination runs. The config is rejected otherwise.
  • With create_schema: true and no schema_location, the backend uses the destination’s dataset_location. If schema_location is set and differs, Bizon warns.

Queues pass iterations from the producer (source) to the consumer (destination) in the thread and process runners. The stream runner doesn’t use a queue.

TypeStatus
python_queueSupported. In-memory, no external dependencies
kafkaUnmaintained
rabbitmqUnmaintained
engine:
queue:
type: python_queue
config:
max_nb_messages: 1000000
max_bytes: 1073741824
queue:
max_size: 0
consumer:
poll_interval: 1
FieldTypeDefaultDescription
max_nb_messagesint1000000Pause the producer once the queue holds about this many records, estimated from the average records per iteration
max_bytesintNonePause the producer once the queued iterations take about this many bytes, estimated from the average size of the iterations produced so far
queue.max_sizeint0Maximum number of iterations in the queue. 0 is unbounded
consumer.poll_intervalint1Seconds between consumer polls

Set max_bytes to bound memory when record sizes vary a lot; max_nb_messages alone counts records, not bytes.

Runners control how the pipeline executes: concurrency model and logging.

TypeConcurrencyUse Case
threadProducer and consumer threadsDefault, most workloads
processProducer and consumer processesCPU-heavy transforms
streamSingle loop, no queueContinuous streaming

Runs the producer and consumer in a thread pool, connected by the queue:

engine:
runner:
type: thread
config:
max_workers: 2
consumer_start_delay: 2
is_alive_check_interval: 2
log_level: INFO

If either side fails, the runner stops the other and returns a failed status. A producer that returns an error lets the consumer drain without publishing; a producer that raises stops the consumer.

Runs the producer and consumer in separate processes:

engine:
runner:
type: process
config:
max_workers: 2
log_level: INFO
Terminal window
bizon run config.yml --runner process
  • It uses at least 2 workers, whatever max_workers says, so the consumer never waits behind a producer blocked on a full queue.
  • Workers start with spawn on every platform.
  • A failing consumer stops the producer, and a producer that raises stops the consumer.
  • Workers log at log_level.
  • It returns a status like the thread runner, so --result-json works.

Reads a batch, applies transforms, writes it straight to the destination and commits the source, in one loop that runs until stopped. There is no queue, and the destination buffer is disabled. Use it with sync_mode: stream sources such as Kafka:

Terminal window
bizon run config.yml --runner stream

For Kafka → bigquery_streaming_v2 stream pipelines, bizon-rs is a native Rust worker that writes byte-identical rows at a fraction of the CPU. It accepts a strict subset of this config: its engine block takes only runner.type and runner.log_level, and rejects engine.backend and engine.queue.

FieldTypeDefaultDescription
typeenumthreadthread, process or stream. Overridden by --runner
config.max_workersint2Pool size. The process runner uses at least 2
config.consumer_start_delayint2Seconds to wait after starting the producer before starting the consumer
config.is_alive_check_intervalint2Seconds between liveness checks (thread runner)
log_levelenumINFOTRACE, DEBUG, INFO, WARNING, ERROR or CRITICAL

An incremental pipeline whose state lives next to its data in BigQuery:

name: hubspot-contacts
id: hubspot-contacts
source:
name: hubspot
stream: contacts
sync_mode: incremental
authentication:
type: api_key
params:
token: gsm://hubspot-api-token
destination:
name: bigquery
config:
project_id: my-project
dataset_id: raw_hubspot
dataset_location: EU
create_dataset: true
gcs_buffer_bucket: my-project-bizon-buffer
engine:
backend:
type: bigquery
config:
database: my-project
schema: raw_hubspot
create_schema: true
syncCursorInDBEvery: 10
queue:
type: python_queue
config:
max_nb_messages: 1000000
max_bytes: 1073741824
secrets:
gsm:
project_id: my-project
Terminal window
bizon run config.yml --result-json /tmp/bizon-result.json

The backend inherits EU from dataset_location when it creates the dataset. id keeps the pipeline’s state if name changes.

Simple local setup:

name: dev-pipeline
source:
name: dummy
stream: creatures
authentication:
type: api_key
params:
token: dummy_key
destination:
name: logger
config: {}

With no engine: block, Bizon uses a sqlite backend (bizon.sqlite3), an unbounded python_queue and the thread runner.