One metadata-driven pipeline for ~50 database sources (~100 tables each), ~50 REST APIs and files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago - last edited a week ago
Hi all,
We're designing ingestion into Databricks and want honest, critical feedback from people who've run something similar at scale.
The approach
Everything is read from control tables, and extraction runs dynamically for each metadata row. There is no per-source pipeline. Each source type has its own metadata layout.
REST API metadata row
- method, endpoint URL, request body, URL filters
- auth type, token details, client ID and client secret (stored as secret scope references, never as values)
- pagination type and page limit
- incremental column
- response type (JSON, KQL or binary) and JSON level to flatten from
- target Bronze table and target blob location
Relational source metadata row
- source server, database, schema, and table name or custom query
- filters and other JDBC options
- target Bronze table and target blob location
Flat file and Parquet metadata row
- source path (blob or cloud storage location) and file name pattern
- file format (CSV, Parquet or other flat file)
- read options, for example delimiter, header, encoding and quote character
- schema or schema hints
- incremental method (for example, only new or modified files since the last run)
- filters
- target Bronze table and target blob location
Scale and constraints
- ~50 relational sources × ~100 tables each (~5,000 tables), plus ~50 APIs and the file sources, all handled by the same pipeline logic. We'd either run it as one pipeline, or as multiple parallel runs of it, each reading ~10 metadata rows, to improve parallelism.
- A 6-hour latency is acceptable, so this is scheduled batch, not near-real-time.
- No CDC, no change tracking, and no third-party replication tool with its licensing cost.
- Parallelism: metadata rows are split into batches of ~10. Each batch is picked up by its own job run (or parallel task), so batches load independently and one failure doesn't stop the others.
Questions
- Is this appropriate at this scale, or does it break somewhere (concurrency, driver limits, source load, orchestration)?
- With a 6-hour window and no CDC or change tracking, is an incremental column plus periodic key comparison enough to handle updates and hard deletes? How often would you run the full key check?
- Which would you choose: one pipeline that processes all ~5,000+ metadata rows, or multiple runs of the same pipeline, each handling ~10 rows? Or a single orchestrating job with a for-each task and a concurrency limit? How would you avoid overlapping batches, overloading one source, or hitting job and concurrency limits?
- For flat files and Parquet, would you handle them in the same pipeline, or use Auto Loader or another native approach separately? How do you handle schema changes and late-arriving files?
- Would you use CDC or managed connectors for a small set of critical tables and the metadata-driven approach for the rest?
- For APIs, how far can metadata go before it becomes a mini programming language? Where would you stop and write code?
- How do you handle large tables via JDBC (partition column and bounds, fetch size) in a metadata-driven setup?
- How would you handle schema drift, rate limits and token refresh?
- What do teams underestimate with this pattern: monitoring, cost, ownership, testing?
- Is the licensing saving real once you count compute and engineering time?
- Why would this approach not work? Please be as critical as you like.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Short answer: the metadata-driven approach works at this scale. What usually breaks is the orchestration around it, specifically fixed batches of 10, per-run overhead and putting too much load on one source database. The pattern itself holds up.
Orchestration
I'd use one orchestrating job instead of 500 separate runs:
- Task 1: reads the control tables and outputs one input value per source (DB server, API or file root). It doesn't output one per table.
- Task 2: a For each task with Concurrency = how many sources you want to load at the same time. The nested notebook loads that source's tables using a small thread pool. Set the pool size from a max_parallel_connections column in metadata. That column is how you protect each source.
- Set max_concurrent_runs = 1 on the job so a slow run can't overlap the next scheduled one.
- Keep in mind the workspace limit of 2,000 concurrent task runs. Calls that go over it get a 429.
Fixed batches of 10 cause skew: one batch ends up with five huge tables and the rest finish early. Assigning work per source avoids that. A failure should only mark that table's row in a run-log table. Don't fail the whole source because of one table.
Incremental column and deletes
- Only advance the watermark after the Bronze write commits. Re-read a lookback window, because late commits on the source can be missed.
- An incremental column catches inserts and updates, but it never catches hard deletes. For deletes, pull only the primary keys and run an anti-join against Bronze. I'd do that daily for small and medium tables, and weekly for large ones, spread across sources so you don't hit them all at once.
Before building the DB part yourself
Look at Lakeflow Connect query-based connectors. They use a cursor column, and the reference documents hard_deletion_sync_min_interval_in_seconds for detecting hard deletes. That feature is Beta and can only be configured through the API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
I think the metadata-driven approach is a reasonable foundation for this architecture, but I would challenge the idea of using one universal execution pipeline for all 5000 relational tables, REST APIs and file sources.
At this scale, the difficult part is usually not reading the metadata or dynamically generating extraction logic.
The real challenges are source consistency, concurrency control, incremental correctness, recovery and operational visibility.
Given your six-hour latency requirement, I would design this as a metadata-driven ingestion framework with source-specific execution strategies rather than one generic pipeline handling every workload identically.
Here is how I would approach the architecture.
1. Separate metadata management from execution.
I would maintain a central control framework containing:
- Source system and source type.
- Table or API identifier.
- Extraction strategy.
- Incremental watermark configuration.
- Source-specific connection limits.
- Target Bronze table.
- Schema version.
- Retry policy.
- Last successful extraction state.
- Run status and reconciliation information.
The control layer should decide what needs to run, while specialized extraction components handle JDBC, REST APIs and files.
This prevents the metadata framework from becoming a large collection of conditional statements for every possible source behavior.
2. Avoid fixed batches of ten tables.
I would not assume that ten tables represent a reasonable unit of work.
For example, one batch could contain ten tables with only a few thousand rows each, while another contains ten tables with hundreds of millions of rows.
Both batches would have very different execution times and source resource requirements.
Instead, I would classify workloads by estimated size, extraction duration and source capacity.
For example:
- Small tables: lightweight parallel extraction.
- Medium tables: controlled JDBC reads.
- Large tables: partitioned extraction with explicit connection limits.
- Critical tables: dedicated pipelines or managed connectors where justified.
The orchestration system should dispatch work according to source capacity rather than a fixed number of metadata records.
Lakeflow Jobs For each tasks can help with bounded parallel execution, but I would still enforce source-level concurrency controls.
A global concurrency limit alone is not sufficient if several parallel tasks connect to the same operational database.
3. Treat incremental extraction without CDC as the biggest correctness risk.
This is the part of the design I would investigate most carefully.
An updated_at column can help identify inserted or updated records, but it does not reliably capture hard deletes.
It can also miss updates if timestamps are unreliable or if rows change while extraction is running.
Consider a simple example.
At 10:00, customer 101 exists in the source.
At 11:00, the customer is deleted.
At 12:00, the extraction retrieves records where updated_at is greater than the previous watermark.
Because the deleted row no longer exists, the extraction does not return any event describing the deletion.
The target could continue showing customer 101 indefinitely unless a separate reconciliation process detects the missing record.
Periodic key comparison can help, but it has limitations.
- Comparing all source keys across 5000 tables can be expensive.
- A key comparison performed during concurrent source modifications may produce inconsistent results.
- Detecting a missing key is not equivalent to capturing the exact deletion time.
- Timestamp-based extraction may still miss updates when source applications do not maintain timestamps reliably.
I would therefore classify tables according to their change characteristics and business requirements.
For append-only tables, a high-watermark approach may be sufficient.
For mutable tables without reliable change tracking, I would consider periodic source-consistent snapshots or key reconciliation where the source can support them.
For critical tables requiring accurate update and delete history, I would seriously evaluate CDC or a managed connector.
I would not describe watermark extraction plus periodic reconciliation as equivalent to CDC.
4. Make extraction state transactional and retries idempotent.
At this scale, partial failures are unavoidable.
Suppose a job extracts 2 million records, writes 1 million records to Bronze and then fails.
If the next run advances the watermark incorrectly, some records may never be processed.
If the next run blindly repeats the extraction, the target may contain duplicates.
I would introduce a run identifier and track extraction state separately from the source watermark.
A safe pattern would be:
- Read the last committed watermark.
- Establish a bounded extraction window using a reliable source position or timestamp where supported.
- Extract and persist the source records.
- Validate the output.
- Commit the ingestion result.
- Advance the watermark only after successful completion.
The implementation also needs to handle failure between the data commit and the control-table update. This can be addressed using deterministic batch identifiers, idempotent writes and recovery checks.
For REST APIs, I would track pagination state and request boundaries while accounting for APIs where page contents can change during extraction.
5. Use the right ingestion mechanism for each source.
For JDBC sources, I would use controlled parallel reads where the source database can support them.
For files in cloud object storage, I would prefer Auto Loader when its incremental discovery and schema evolution capabilities fit the requirements.
For REST APIs, I would use a dedicated adapter supporting pagination, rate limits, authentication renewal, retries and response validation.
The important distinction is that all three mechanisms can be governed through shared metadata without requiring identical extraction code.
For file ingestion, I would also define how schema changes and late-arriving files are handled.
For APIs, I would keep metadata focused on configuration.
Once the metadata needs to express complex branching, custom token refresh algorithms or arbitrary transformations, I would move that behavior into tested code.
Metadata should configure the execution strategy, not become a programming language.
6. Design observability around individual source entities.
A single job showing SUCCESS does not prove that all 5000 tables are current and correct.
I would track at least:
- Last successful extraction time.
- Source and target row counts where meaningful.
- Extraction duration.
- Watermark lag.
- Records inserted, updated and deleted where measurable.
- Failed and retried extraction attempts.
- Schema change events.
- Source connection failures.
- Data freshness against the six-hour SLA.
For example, if 4999 tables complete successfully but one critical financial table has not refreshed for 18 hours, the platform should highlight that table rather than reporting only the success rate of the overall workflow.
I would also distinguish ingestion freshness from completeness. A recent successful run may still have missed source updates or deletes.
7. Benchmark before committing to the framework.
I would not start by implementing all 5000 tables.
Instead, I would build a representative pilot containing:
- Small, medium and large JDBC tables.
- Tables with frequent updates and hard deletes.
- REST APIs using different pagination strategies.
- Files with schema changes and late arrivals.
- Sources with strict connection or rate limits.
I would then test source load, throughput, retries, recovery and total operating cost.
One useful test would deliberately interrupt an extraction after data has been written but before the watermark is committed.
The expected behavior is that the next execution recovers without missing records or creating duplicates.
Another important test would remove a source record and verify whether the chosen reconciliation strategy detects the deletion within the agreed freshness window.
Finally, I would compare the engineering cost of maintaining this custom framework against managed ingestion alternatives.
The licensing savings may be meaningful, but I would include ongoing maintenance, source-specific troubleshooting, monitoring and operational support in the comparison.
My recommendation:
Keep one metadata-driven control framework, but allow different ingestion adapters and execution strategies behind it.
Use Lakeflow Jobs for orchestration, enforce per-source concurrency limits, keep extraction state recoverable and use CDC selectively where business correctness requires it.
The part I would challenge most strongly is the assumption that incremental timestamps plus occasional key reconciliation are sufficient for every table.
One question would help determine the right architecture:
Of the 5000 relational tables, approximately how many are append-only, how many contain frequent updates and how many require accurate hard-delete detection?
That classification would drive the ingestion strategy much more effectively than assigning every table to the same batch size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sunday
Scale orchestration - The pattern is appropriate but breaks in few places, none of which is due to Spark compute - a single pipeline run serializes extractions behind one driver, so run it as one orchestrating job with a For each task and a concurrency limit (25 parallel iterations each taking a batch of metadata rows) rather than one monolithic run or dozens of manually cloned jobs. Have each batch claim its rows by atomically stamping the control table with the run ID as it is the reliable way to prevent overlapping batches and group batches by source server so you never open parallel connections against the same database.
A pipeline SDP task inside a For each loop is capped to one concurrent iteration and a job with a pipeline task cannot run in parallel, so the loop's inner task should be a notebook task and not a pipeline if feasible. A single cluster errors beyond 150 concurrent execution contexts, so split across clusters or cap concurrency. For large JDBC tables, drive partitioned reads from metadata using partition column, computed bounds, partition count and an explicit fetch size since drivers like Oracle default to a fetch size of 10 rows and push row filters down so you are not filtering after transfer. Limit one metadata row's schema mapping to column types and handle type mismatches via an explicit schema hint instead of relying on inference.
Incrementals, deletes, files, APIs and drift With no CDC, an incremental column plus a periodic full key comparison is a decent design - the key check (an anti-join of source keys against Bronze keys) is an mechanism that catches hard deletes - run it weekly by default, nightly for tables where delete staleness matters and treat the interval as a business decision (how stale a delete you can tolerate). For flat files and Parquet, take them out of the framework and use Auto Loader as it natively handles incremental discovery of new files, late arriving files, exactly once and schema evolution with configurable modes (add new columns, fail on new columns or ingest unpredictably shaped data as Variant), plus a rescued data column that makes drift observable. Handle rate limits with a shared backoff helper that honors Retry After headers, refresh tokens centrally in code backed by secret scopes and treat schema drift as a control table event to route. For the small set of critical tables, use Lakeflow Connect managed database (CDC) or query-based connectors and reserve the framework for the long tail.
Monitoring and observability is underestimated (a per-row status table with row counts, watermark lag and duration), testing (mock sources per connector type before any source changes). Run it as managed connectors and Auto Loader for what they natively cover, a For-each-orchestrated, metadata framework for the relational and API long tail, weekly checks and monitoring tables.