Ingestion operators
Ingestion operators move data from a named source into a named destination. They turn an asset definition into a transfer run that can read tables, API resources, files, or streams and write the result as destination data. The operator carries the source contract, load policy, metadata, and run context across this boundary. See Data connectivity and ingestion for the wider connection model, Connection configuration for connection setup, and Source and destination integrations for platform coverage.
Operator role
The ingestion operator is the pipeline boundary for source-to-destination movement. An ingestr asset names the source resource and destination target. The operator resolves both ends, checks the asset contract, selects the requested ingestion engine, and starts the transfer engine.
Asset contract
An ingestion asset uses type: ingestr. Its parameters describe the input and destination. The asset name becomes the destination table name unless destination_table overrides it. A separate seed form uses path for local or remote files and follows the same destination and schema flow as other ingestion assets. pkg/…/pipeline.go• L1307-1332 pkg/…/operator.go• L235-256 pkg/…/operator.go• L928-980
The main fields have these roles:
| Field | Role |
|---|---|
source_connection | Names the configured source or a supported public source. |
source | Chooses a source scheme when a connection can serve more than one source. |
source_table | Identifies the table, API resource, file location, topic, queue, or query to read. |
connection | Names the destination connection directly. |
destination_connection | Selects a destination connection when connection is not set. |
destination | Selects a known destination type and its pipeline default connection. |
materialization | States how rows are written to the destination. |
References: pkg/…/pipeline.go• L1307-1332 pkg/…/pipeline.go• L2544-2560 pkg/…/operator.go• L235-256 pkg/…/operator.go• L488-507 pkg/…/operator.go• L928-980
Transfer lifecycle
The transfer starts after the pipeline resolves both ends. The source URI and resource form the read side. The destination URI and target table form the write side. The operator then combines load settings and column metadata before it gives the request to the ingestion engine.
This diagram shows how an asset becomes destination data.
flowchart LR
A[Ingestion asset] --> B[Resolve source]
A --> C[Resolve destination]
B --> D[Source URI and resource]
C --> E[Destination URI and table]
D --> F[Ingestion engine]
E --> F
F --> G[Destination data]
The operator also prepares destination support and manages cancellation for long-running transfers. Engine selection is part of this boundary. An empty version uses the current v1 family. A v0 or v1 family marker resolves to its pinned release. A full version can select an exact release. pkg/…/operator.go• L26-53 pkg/…/operator.go• L285-291 pkg/…/helper.go• L57-135
References: pkg/…/operator.go• L26-53 pkg/…/operator.go• L285-291 pkg/…/helper.go• L57-135
Source definitions
Source definitions describe what a connector can read. They separate a source type from a source resource. This lets one connector expose many tables or resource shapes through the same ingestion asset model.
Source resource catalog
The source catalog is the shared discovery view for source resources. Each entry can provide a resource name, a primary key, an incremental key, and a default incremental strategy. These values guide source selection and load setup. They do not replace the external system schema or prevent an asset from supplying more precise metadata.
The catalog supports several resource forms:
- Fixed resources such as CRM objects or accounting records.
- Parameterized resources whose values are part of
source_table. - User-defined paths for files, database tables, indexes, topics, queues, and streams.
- Dynamic API resources that include request values or query parameters.
The registry is the single source for source-table metadata used by source discovery tools. GetSourceTables returns one source with its tables sorted by name. It returns a new table slice so callers do not change the shared registry. GetAllSources returns all sources sorted by name. A missing source produces an error instead of an empty result. The catalog also includes user-defined Azure Blob Storage paths through the azure_blob source entry. pkg/…/sources.go• L21-40 pkg/…/sources.go• L1534-1572 pkg/…/sources_test.go• L9-523
References: pkg/…/sources.go• L21-40 pkg/…/sources.go• L1534-1572 pkg/…/sources_test.go• L9-523
Source selection
The asset selects a source with source_connection and source_table. The pipeline resolves the connection in the active environment and passes its ingestion URI to the operator. A source value can choose a source scheme when the connection type alone is not enough.
Some credential-free sources use canonical public names. A configured connection with the same name takes priority. This allows a project to replace a public source with an authenticated or custom connection.
The resource can be a table name, a service-specific resource, or a custom SQL query. A query must return any incremental key used by the asset and must apply its own interval filter when needed. pkg/…/pipeline.go• L2452-2469 pkg/…/pipeline.go• L2529-2534 pkg/…/operator.go• L311-348
BigQuery sources can set read_api to storage or rest. An asset value overrides the value in the source connection URI. The setting applies only to a BigQuery source, and the selected ingestion release must support it. A BigQuery destination does not trigger this source-side version check. pkg/…/operator.go• L140-187 pkg/…/operator_bigquery_read_api_test.go• L50-127
References: pkg/…/pipeline.go• L2452-2469 pkg/…/pipeline.go• L2529-2534 pkg/…/operator.go• L311-348 pkg/…/operator.go• L140-187 pkg/…/operator_bigquery_read_api_test.go• L50-127
Metadata and annotations
Metadata tells the operator how to read and load source rows. Annotations identify the pipeline work that produced or moved those rows. Together they preserve data meaning and run context without putting either concern into the source connection.
Source metadata
Source metadata can suggest a primary key, an incremental field, and a load strategy. Asset columns can refine this information with source names, types, key flags, masks, and other column properties.
The load request uses this metadata to:
- Match rows for supported merge loads through primary keys.
- Continue later runs from an incremental key.
- Apply declared types when schema enforcement is enabled.
- Apply masks before data reaches the destination.
- Describe destination layout through partition and cluster settings where supported.
The preferred place for destination write policy is materialization. Older incremental parameters remain supported as legacy inputs. The operator rejects conflicting values instead of silently choosing between the two forms. pkg/…/pipeline.go• L656-664 pkg/…/pipeline.go• L849-873 pkg/…/operator.go• L672-730 pkg/…/helper.go• L57-77
References: pkg/…/pipeline.go• L656-664 pkg/…/pipeline.go• L849-873 pkg/…/operator.go• L672-730 pkg/…/helper.go• L57-77 pkg/…/helper.go• L120-132
Run annotations
Run annotations are optional structured data for query attribution. For the v1 ingestion engine, the operator combines pipeline identity, asset identity, and run-level annotations before it starts the run. This gives the orchestrator one place to attach values such as a project, run ID, or attempt number.
The operator omits the payload when annotations are disabled. Invalid annotation JSON fails the run. The older v0 engine does not receive this setting because it does not support it. pkg/…/operator.go• L56-95 pkg/…/utils.go• L22-53
References: pkg/…/operator.go• L56-95 pkg/…/utils.go• L22-53
Validation boundaries
Validation protects the contract between an asset, its connections, and the ingestion engine. Bruin checks values it owns before the transfer starts. Source, destination, credential, and engine limits that belong to external systems can still fail during execution.
Configuration validation
The operator rejects an asset before data movement when it cannot form a valid source-to-destination request. The main checks are:
| Check | Required result |
|---|---|
| Source connection | source_connection resolves to a supported source URI. |
| Source resource | source_table is present, except in the supported CDC wildcard form. |
| Destination | A direct connection, destination connection, or known destination default is available. |
| Materialization | The type is table, and the strategy maps to an ingestion strategy. |
| Incremental key | It is used only with append, merge, or delete+insert. |
| CDC strategy | CDC uses merge; the operator sets it when omitted and rejects another value. |
| BigQuery read API | read_api is storage or rest, applies only to a BigQuery source, and needs ingestr 1.1.92 or newer when present. |
| Engine feature | A requested feature is available in the selected ingestr release. |
An incremental predicate is not supported for ingestion assets. CDC-only controls are checked against the source type and mode. PostgreSQL CDC snapshot controls require a supported release. Chunked snapshots and WAL spool mode are separate choices. Spool mode has its own staging and buffer rules. Other version-gated controls include CDC table naming, metrics, and load controls. The operator fails before execution when these contracts do not match. pkg/…/operator.go• L293-309 pkg/…/operator.go• L672-730 pkg/…/operator.go• L190-215 pkg/…/operator_cdc_chunked.go• L11-41 pkg/…/operator.go• L140-187
References: pkg/…/operator.go• L293-309 pkg/…/operator.go• L672-730 pkg/…/operator.go• L190-215 pkg/…/operator_cdc_chunked.go• L11-41 pkg/…/operator_cdc_chunked_test.go• L14-167 pkg/…/operator_cdc_parity_test.go• L71-270 pkg/…/operator_bigquery_read_api_test.go• L103-127
Execution checks
Batch ingestion assets can run column checks and custom checks through the destination check operator. Metadata push follows destination capability. If a destination lacks the operation or a usable connection, Bruin skips that task.
Streaming assets use a different execution boundary. A stream runs the main ingestion task but does not run normal column checks, custom checks, or metadata push tasks. This prevents a live source from being treated as a completed batch. pkg/…/checks.go• L14-31 pkg/…/checks.go• L39-56 pkg/…/checks.go• L64-92 pkg/…/operator.go• L754-773
References: pkg/…/checks.go• L14-31 pkg/…/checks.go• L39-56 pkg/…/checks.go• L64-92 pkg/…/operator.go• L754-773
URI handling
URIs are the runtime form of a connection for ingestion. The URI bridge converts a named connection into the scheme and access details expected by the ingestion engine. The operator adds source mode and destination options around that base form.
Connection URI resolution
Every ingestion-capable connection exposes one ingestion URI. Bruin looks up the connection by name and checks that it supports this capability. A missing connection, unsupported connection type, or empty URI produces a clear error.
Source URIs are normalized before they reach the ingestion engine. The operator can adapt connection details to the selected engine family. For example, v1 SQL Server settings use boolean values that differ from the legacy v0 form. pkg/…/uri.go• L16-80 pkg/…/operator.go• L311-348 pkg/…/operator.go• L785-828
References: pkg/…/uri.go• L16-80 pkg/…/operator.go• L311-348 pkg/…/operator.go• L785-828
BigQuery read API
The BigQuery read API setting selects how a BigQuery source reads data. The operator first accepts the connection URI value, then replaces it when the asset supplies read_api. It validates the value before adding it to the source URI.
The setting is source-only. A destination URI that contains read_api does not receive a version check. If the source URI contains the setting from either the connection or the asset, the selected ingestr release must be 1.1.92 or newer. pkg/…/operator.go• L140-187 pkg/…/operator_bigquery_read_api_test.go• L50-127
References: pkg/…/operator.go• L140-187 pkg/…/operator_bigquery_read_api_test.go• L50-127
CDC URI conversion
Change data capture, or CDC, reads source changes instead of only taking a table snapshot. When cdc: true is set, the operator changes a supported source URI to its CDC form and adds the settings needed by that source.
Supported source families include PostgreSQL, MySQL and MariaDB, Vitess, PlanetScale, MongoDB, and SQL Server. SQL Server can use log-based CDC or Change Tracking. CDC uses the merge destination policy because the destination must apply row changes.
PostgreSQL CDC can also carry source-side controls for discovery, binary transfer, publication, slot, snapshot, table naming, and state. These controls stay in the URI or become engine flags as required by the selected release. The operator does not pass unsupported controls to unrelated source families.
The same source can run as a finite CDC batch or as a continuous stream. stream: true is the current setting. The older cdc_mode: stream form remains a compatibility alias. pkg/…/operator.go• L348-459 pkg/…/operator.go• L461-476 pkg/…/operator.go• L754-773 pkg/…/operator_cdc_parity_test.go• L71-187
References: pkg/…/operator.go• L348-459 pkg/…/operator.go• L461-476 pkg/…/operator.go• L754-773 pkg/…/operator_cdc_parity_test.go• L71-187
Seed file URIs
Seed assets turn a file path into a file URI before transfer. The format can come from file_type or from the path extension. Supported formats include CSV, Parquet, JSON, JSONL, NDJSON, and Avro. HTTP and HTTPS paths pass through unchanged.
The seed source uses the logical resource seed.raw. The destination table still comes from the asset name. The operator adds a destination database or schema when the destination requires one. pkg/…/operator.go• L604-643 pkg/…/operator.go• L928-1037 pkg/…/operator.go• L1040-1103
References: pkg/…/operator.go• L604-643 pkg/…/operator.go• L928-1037 pkg/…/operator.go• L1040-1103
Destination loading
The destination side controls how source rows become durable data. The operator selects a destination URI and target table, then combines materialization, column metadata, interval settings, and full-refresh state into one ingestion request.
Load strategies
The supported write strategies describe how a run changes the target table:
| Strategy | High-level behavior |
|---|---|
replace | Rebuilds the target from the current source result. |
append | Adds new source rows to the target. |
merge | Matches rows by primary key and applies new or changed rows. |
delete+insert | Removes matching rows and inserts the current source rows. |
truncate+insert | Clears the target and inserts the current source rows. |
materialization.strategy is the preferred asset setting. Bruin maps it to the ingestion engine strategy and keeps matching legacy parameters when present. A merge needs usable primary keys. A CDC asset must use merge. The destination must also support the selected strategy. pkg/…/materialization_mapping.go• L16-22 pkg/…/materialization_mapping.go• L70-77 pkg/…/operator.go• L672-730
References: pkg/…/materialization_mapping.go• L16-22 pkg/…/materialization_mapping.go• L70-77 pkg/…/operator.go• L672-730
Streaming mode
Streaming mode keeps the ingestion process open so it can read broker events or source changes over time. Bruin classifies an asset as streaming when it has stream: true or uses the deprecated CDC stream alias.
The run can use an initial interval start but does not send an interval end. An end would stop the live tail. CDC snapshot options can still apply to a stream when the source and engine support them. Bruin starts the stream as a managed process and closes it when the run is cancelled. pkg/…/operator.go• L478-485 pkg/…/operator.go• L537-542 pkg/…/operator.go• L594-601 pkg/…/helper.go• L99-118
References: pkg/…/operator.go• L478-485 pkg/…/operator.go• L537-542 pkg/…/operator.go• L594-601 pkg/…/helper.go• L99-118
Change checklist
When these files or sections are changed, remember to consider these:
- Keep
source_connection,source, andsource_tablealigned with the source URI scheme and catalog entry. - When source metadata changes, check primary keys, incremental keys, default strategies, discovery output, and destination merge behavior together.
- When a source registry entry changes, check its discovery shape and the stable ordering returned by source listing.
- When a destination mapping changes, check direct connections, destination defaults, and destination check and metadata-push routing.
- When materialization names change, keep the Bruin-to-ingestion strategy map and validation rules aligned.
- When URI or CDC schemes change, check normalization, source settings, stream classification, and the external ingestion contract together.
- When a source URI gains or loses a setting such as BigQuery
read_api, check connection values, asset overrides, source-only version gates, and engine support together. - When CDC snapshot controls change, keep source-family checks, release gates, mutually exclusive modes, and engine flags aligned.
- When column metadata changes, check type hints, source-column names, key flags, masks, and schema enforcement as one contract.
- When annotation fields change, preserve the v1-only gate and the merge behavior for run-level annotations.
- When seed formats or destination qualification rules change, keep local-path handling, remote URL pass-through, and destination database or schema selection aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
source_connection or source_table is missing | The operator stops before it can build the transfer | Define both fields or use the supported CDC wildcard form |
| The source name is not configured or public | Source URI resolution fails | Use the exact connection name or canonical public name |
| No destination connection is available | Bruin cannot select the write endpoint | Set connection, destination_connection, or a mapped destination default |
| A connection has no ingestion URI | The transfer cannot start | Use an ingestion-capable connection type |
read_api has an invalid value or targets a non-BigQuery source | Source URI preparation fails | Use storage or rest only with a BigQuery source |
A BigQuery source URI carries read_api on an old ingestr release | Validation stops before the run | Use ingestr 1.1.92 or newer |
CDC uses an unsupported source or non-merge strategy | URI conversion or validation fails | Use a supported CDC source and merge |
| A merge has no usable primary key | Changed rows cannot be matched safely | Define source or asset key metadata |
| A CDC snapshot control uses the wrong source, mode, or engine release | Validation stops before the CDC run | Use PostgreSQL CDC for PostgreSQL-only controls and a release that supports the feature |
| Chunked and spool snapshot modes are combined | Snapshot validation fails | Select one snapshot mode and satisfy its staging rules |
| An incremental key uses an incompatible strategy | Asset validation rejects the materialization | Use append, merge, or delete+insert |
| A stream runs as a normal batch | The task cannot finish as a batch | Use the dedicated stream mode |
| Run annotation text is invalid JSON | The v1 run stops before execution | Pass valid JSON or disable annotations |
| A seed uses an unsupported file format | The seed URI cannot be built | Use a supported file format |
| A requested source is not in the catalog when a fixed resource is required | Discovery cannot provide its metadata | Register the resource or use the connector's supported dynamic form |
Key files
| File | Why to read it |
|---|---|
| pkg/…/operator.go | Shows the source-to-destination boundary, engine selection, validation, BigQuery source options, CDC handling, seed handling, and stream classification. |
| pkg/…/operator_bigquery_read_api_test.go | Confirms BigQuery read_api overrides, allowed values, source-only behavior, and the release boundary. |
| pkg/…/operator_cdc_chunked.go | Shows the boundary for PostgreSQL CDC snapshot chunking and WAL spool controls. |
| pkg/…/uri.go | Defines connection URI lookup, normalization, and CDC conversion. |
| pkg/…/sources.go | Defines the source resource catalog and stable source discovery, including user-defined Azure Blob Storage paths. |
| pkg/…/sources_test.go | Confirms representative source resources and their key and strategy metadata. |
| pkg/…/operator_cdc_parity_test.go | Shows the source and engine contracts for CDC URI controls, naming, snapshots, metrics, and load controls. |
| pkg/…/pipeline.go | Defines the ingestion asset shape, source and destination selection, columns, and materialization fields. |
| pkg/…/helper.go | Shows how ingestion metadata and intervals become runtime options. |
| pkg/…/materialization_mapping.go | Defines the mapping from asset materialization strategies to ingestion strategies. |
| pkg/…/checks.go | Shows how destination checks and metadata push tasks are routed or skipped. |
| pkg/…/utils.go | Defines shared annotation merge behavior. |
| docs/…/ingestr.md | Provides the user-facing ingestion asset contract and streaming guidance. |