CertSafari
    Databricks Certified Data Engineer Professional - October 9 onwards· Lessons

    Domain 2 · Lesson 15/45

    Lakeflow Connect CDC ingestion from SQL Server, MySQL and PostgreSQL

    Configure CDC ingestion pipelines from relational database sources, including SQL Server, MySQL, and PostgreSQL, using Lakeflow Connect.

    21 min read
    2.4% of exam
    11 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Trace a change from a source database through the connection, ingestion gateway, staging volume and ingestion pipeline into destination streaming tables
    • Choose between the gateway-based architecture and an integrated CDC pipeline based on scheduling and compute constraints
    • Prepare SQL Server, MySQL and PostgreSQL for CDC ingestion, including the replication user each one needs
    • Choose SCD Type 1 or Type 2 history tracking for replicated tables and know what breaks Type 2
    • State the release status of each relational database connector

    Key concept

    Decoupled capture and apply — A Lakeflow Connect database connector splits CDC into two jobs. An always-on ingestion gateway reads changes from the source and lands them in a Unity Catalog staging volume. A separate ingestion pipeline applies those staged changes to streaming tables on whatever schedule you choose.

    1.How a database connector moves changes: gateway, staging, pipeline

    Lakeflow Connect gives you managed connectors that copy relational tables into Databricks with change data capture. You don't hand-write merge logic for each table. You declare which source tables you want, and the connector keeps Delta tables in sync with them. The same five-part design covers SQL Server, MySQL and PostgreSQL, so once you know the parts, setting up any of the three is mostly a matter of preparing the source database.

    The five components of a Lakeflow Connect database connector
    ComponentWhat it isWhere it runs or lives
    ConnectionUnity Catalog securable object holding the database's authentication detailsUnity Catalog
    Ingestion gatewayPipeline that extracts snapshots, change logs and metadata from the sourceClassic compute, running continuously
    Staging storageUnity Catalog volume that temporarily holds extracted data before it is appliedVolume in a catalog and schema you can customise; purged after 30 days
    Ingestion pipelinePipeline that moves data from staging into the destination tablesServerless compute, on your schedule
    Destination tablesStreaming tables, which are Delta tables with incremental-processing supportDestination catalog and schema

    The gateway has to run all the time because the source database will not keep its change log forever. SQL Server change tables, MySQL binlogs and PostgreSQL write-ahead logs all get truncated or recycled eventually. If nothing reads them in time, the changes are lost. So the gateway runs continuously on classic compute inside your workspace VPC or VNet, and it needs a network path to the database. VPN, Direct Connect, ExpressRoute, peering and public endpoints all work, and so does cross-cloud: an Azure workspace can ingest from AWS Aurora PostgreSQL.

    The staging volume is what lets capture and apply run on different schedules. The gateway writes extracted snapshot and change-log rows into this Unity Catalog volume. The ingestion pipeline reads them from there later, whether hourly, daily or on any other schedule, and the volume also helps with failure recovery. Three other components are easy to mistake for it. The connection object stores only credentials. A checkpoint records offsets, not rows. The destination schema holds the finished streaming tables. Only the staging volume holds the extracted data while it waits. It is created automatically when you deploy the gateway, and staged data is purged after 30 days.

    The two pipelines also cost money differently. The ingestion pipeline is serverless and only bills while it runs. The gateway's classic compute bills around the clock, even when the ingestion pipeline is idle. Size the gateway for the initial snapshot, which can fail on undersized compute. For PostgreSQL the minimum is 8 cores.

    Creating a PostgreSQL ingestion gateway with the CLI: gateway_definition names the connection and the staging catalog, schema and volumebash
    gateway_json=$(cat <<EOF
    {
      "name": "$GATEWAY_PIPELINE_NAME",
      "catalog": "$STAGING_CATALOG",
      "schema": "$STAGING_SCHEMA",
      "gateway_definition": {
        "connection_name": "$CONNECTION_NAME",
        "gateway_storage_catalog": "$STAGING_CATALOG",
        "gateway_storage_schema": "$STAGING_SCHEMA",
        "gateway_storage_name": "$GATEWAY_PIPELINE_NAME"
      }
    }
    EOF
    )

    The ingestion pipeline then points at the gateway through ingestion_gateway_id, sets a source_type such as POSTGRESQL, and lists the source objects under objects. Each object is either a single table or a whole schema. The staging catalog and schema can be the same as the destination, but the staging catalog cannot be a foreign catalog.

    Checkpoint 1 of 10· Fill the gap

    This CLI snippet creates a PostgreSQL ingestion gateway. Which key tells the gateway which Unity Catalog object holds the database credentials?

    gateway_json=$(cat <<EOF
    {
      "name": "$GATEWAY_PIPELINE_NAME",
      "catalog": "$STAGING_CATALOG",
      "schema": "$STAGING_SCHEMA",
      "gateway_definition": {
        " ? ": "$CONNECTION_NAME",
        "gateway_storage_catalog": "$STAGING_CATALOG",
        "gateway_storage_schema": "$STAGING_SCHEMA",
        "gateway_storage_name": "$GATEWAY_PIPELINE_NAME"
      }
    }
    EOF
    )

    Checkpoint 2 of 10· Exam question

    A team building a Lakeflow Connect ingestion pipeline from an on-premises SQL Server database needs to explain the architecture to auditors. They ask where extracted snapshot and change-log data is held after the ingestion gateway pulls it from the source, but before the ingestion pipeline applies it to the destination streaming tables. Which component fills that role?

    Sources12

    2.Integrated CDC pipelines: one pipeline instead of two

    SQL Server and MySQL also support an integrated CDC pipeline, which merges the gateway and the ingestion pipeline into a single pipeline. In each update, the pipeline extracts changes into a staging volume and then applies them to streaming tables. Once it has caught up with the source it stops, within a maximum runtime. Nothing runs between updates, so there is no always-on gateway to pay for. In exchange, you schedule the pipeline with a Lakeflow Jobs task.

    Gateway-based versus integrated CDC
    FeatureStandard (gateway-based)Integrated CDC
    PipelinesTwo: ingestion gateway and ingestion pipelineOne unified pipeline
    Source referenceingestion_gateway_idconnection_name plus connector_type: CDC
    ExtractionGateway runs continuouslyEmbedded in each pipeline update
    Staging volumeManaged by the gatewayAuto-created in the destination schema, or set via data_staging_options
    MySQL computeClassic gateway, serverless ingestion pipelineClassic only; serverless not supported
    An integrated SQL Server CDC pipeline created from the CLI: a Unity Catalog connection and an explicit connector type, with no gateway IDbash
    databricks pipelines create --json '{
      "name": "<pipeline-name>",
      "catalog": "<destination-catalog>",
      "schema": "<destination-schema>",
      "ingestion_definition": {
        "connection_name": "<unity-catalog-connection-name>",
        "connector_type": "CDC",
        "objects": [
          {
            "table": {
              "source_catalog": "<source-database>",
              "source_schema": "<source-schema>",
              "source_table": "<source-table>"
            }
          }
        ]
      }
    }'

    Choose the integrated pipeline when triggered runs give you fresh enough data and you want simpler setup. For MySQL it is also the only option with auto full refresh. Each extraction stage runs for at least 10 minutes, so a job interval of 60 minutes or longer is a sensible starting point. An integrated SQL Server pipeline can run on classic or serverless compute. A MySQL one requires classic compute. For SQL Server, the integrated feature must also be enabled for your workspace by your Databricks account team. Both architectures use the same source-database setup, so everything below applies to either one.

    Checkpoint 3 of 10· Check yourself

    A team ingests a MySQL database with Lakeflow Connect. Hourly freshness is enough, and they want to stop paying for compute between loads. Which setup meets both goals?

    Sources34

    3.Preparing SQL Server: change tracking or CDC, on the primary

    SQL Server gives you two ways to track changes, and the connector works with either. Change tracking records that a row changed, but not the operations that changed it. It requires a primary key and puts little load on the database. CDC records every operation and keeps a history of changes over time. It works on tables without a primary key, but it costs the source more performance. Databricks recommends change tracking for any table that has a primary key. Use CDC for keyless tables, and for any table where you need the full operation history (see the history-tracking section below).

    Each method has a minimum version. Change tracking needs SQL Server 2012 or later. CDC needs SQL Server 2012 SP1 CU3 or later, the update that introduced the __$command_id column the gateway uses to tell operation types apart. Below SQL Server 2016, CDC also needs Enterprise Edition. Apart from versions, setup means configuring firewall rules, creating a database user dedicated to Databricks ingestion with the required privileges, and enabling change tracking or CDC on the tables. Databricks documents a utility objects script for this source-side setup, and its documented scope is permission management, change tracking enablement and CDC enablement.

    Point the connector at the primary instance. Change tracking and CDC are not supported on read replicas or secondary instances. A readable secondary in an availability group is still a secondary, however much spare capacity it has. For availability groups, connect through the AG listener address. LSN checkpoints are portable across replicas, so the pipeline can resume after a failover. If you replicate a whole schema, the connector skips any table that has neither change tracking nor CDC enabled.

    Checkpoint 4 of 10· Check yourself

    A SQL Server 2019 availability group has a busy primary and a readable secondary with spare capacity. A team has enabled change tracking on the source tables and is creating an integrated CDC pipeline. Where should its Unity Catalog connection point?

    Checkpoint 5 of 10· Exam question

    A data engineer wants to enable Lakeflow Connect CDC ingestion from a SQL Server availability group by pointing the connector at one of the readable secondary replicas, since it has more spare capacity than the primary. Why will this configuration fail?

    Sources563

    4.Preparing MySQL: row-based binlog and a replication user

    The MySQL connector reads the binary log (binlog), so the binlog has to contain whole rows. Three server settings are required: binary logging on, binlog format set to ROW, and binlog row image set to FULL. How you set them depends on the deployment (RDS/Aurora parameter groups, Azure Flexible Server parameters, a config file on EC2, Cloud SQL flags), but the target values are the same everywhere. Supported versions start at 5.7.44 on RDS, Azure Flexible Server, EC2 and Cloud SQL. Aurora needs 5.7.mysql_aurora.2.12.2 or later.

    The replication user needs four privileges, each for its own reason. REPLICATION SLAVE lets it read the binlogs. REPLICATION CLIENT lets it see replication status and metadata. SELECT(plugin, user) on mysql.user lets the connector validate the authentication plugin. SELECT on the source tables lets it take the initial snapshot and read table metadata. The % host wildcard accepts connections from anywhere, so replace it with the Databricks IP ranges where you can.

    Granting the MySQL replication user its privilegessql
    GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'lakeflow_connect_user'@'%';
    
    GRANT SELECT(plugin,user) ON mysql.user TO 'lakeflow_connect_user'@'%';
    
    -- Grant select privilege on all user tables
    GRANT SELECT ON *.* TO 'lakeflow_connect_user'@'%';
    
    FLUSH PRIVILEGES;

    Unlike SQL Server, MySQL can be ingested from a read replica on Amazon RDS, Azure Database for MySQL and MySQL on EC2. This takes load off the primary, but replication lag between primary and replica makes the ingested data less fresh. Aurora MySQL read replicas are not supported, so Aurora deployments must connect to the primary.

    Checkpoint 6 of 10· Match them up

    A DBA is setting up a MySQL server for the Lakeflow Connect connector and has the three required server settings in front of them. Match each setting to the value the connector needs.

    Tap a term, then the definition that fits it.

    Sources78

    5.Preparing PostgreSQL: publications, replication slots and two sets of credentials

    The PostgreSQL connector uses logical replication. It captures inserts, updates and deletes without triggers and without much overhead on the source. It requires PostgreSQL 13 or later and only works on primary instances, because logical replication isn't available on read replicas. On AWS RDS and Aurora, turn it on by setting rds.logical_replication to 1.

    Two objects on the source define what gets replicated. A publication lists the tables to replicate. A replication slot is created for each catalog (database) you replicate, and it holds the WAL position the connector reads from. Order matters: create the publications before the replication slots. When you build the pipeline, the Database setup page asks for the slot name and publication name of each database. In a bundle they go under source_configurations, as slot_name and publication_name inside slot_config.

    PostgreSQL setup uses two sets of credentials at two different stages. An admin, superuser or table owner creates the replication user, grants its privileges and creates the publications. The replication user then creates the slot itself, so the admin switches to that role to do it. Only the replication user's credentials go into the Unity Catalog connection. The pipeline never uses admin credentials. The replication user needs the REPLICATION attribute, CONNECT on the database, USAGE on each schema, SELECT on the replicated tables, and SELECT on a set of pg_catalog tables.

    Part of the system-catalog grants the PostgreSQL replication user needssql
    GRANT SELECT ON pg_catalog.pg_publication TO databricks_replication;
    GRANT SELECT ON pg_catalog.pg_replication_slots TO databricks_replication;
    GRANT SELECT ON pg_catalog.pg_namespace TO databricks_replication;
    GRANT SELECT ON pg_catalog.pg_class TO databricks_replication;
    GRANT SELECT ON pg_catalog.pg_attribute TO databricks_replication;

    On PostgreSQL, a stopped gateway causes damage at the source. A replication slot keeps every WAL segment its consumer hasn't read yet. If the gateway stops, unconsumed changes pile up and the WAL bloats on the database server. That is why the PostgreSQL gateway must run as a continuous pipeline.

    Checkpoint 7 of 10· Put it in order

    Put these PostgreSQL steps in order, from preparing the source database to giving Lakeflow Connect its credentials.

    1. 1.Switch to the replication user's role and create the replication slot for the database
    2. 2.As an admin, superuser or table owner, create a publication that lists the tables to replicate
    3. 3.Create the Unity Catalog connection using only the replication user's credentials

    Sources9210

    6.Choosing SCD Type 1 or Type 2 for replicated tables

    Each replicated table has a history tracking setting that controls what happens to its destination rows when source rows change. The merge semantics are the same as SCD Type 1 and Type 2 via stored_as_scd_type. In a managed connector you set them through the History tracking drop-down on the Source page of the wizard, or through table_configuration.scd_type (SCD_TYPE_1 or SCD_TYPE_2) in the API, CLI or a bundle. With Type 1, an updated source row overwrites the destination row. With Type 2, the old row is kept and marked inactive, and the new version is added as a new row.

    Pick Type 1 for tables where only the current state matters, such as a lookup of customer contact details. Pick Type 2 when the business needs to know what was true at an earlier date, such as an order's status history. Even with Type 1, deleting a table or column in the source does not delete that data from the destination.

    Two constraints apply to Type 2. On SQL Server, Type 2 requires CDC on the source table. Change tracking only records that a row changed, not each operation, so it can't supply the history. A full refresh erases the history. Auto full refresh repairs problems like log cleanup events and some schema changes by re-snapshotting the affected table, and that discards any Type 2 history the table held. Don't turn auto full refresh on for a Type 2 table you can't afford to lose history from.

    Checkpoint 8 of 10· Check yourself

    Auditors need to see the status each SQL Server order had on any past date. The orders table has a primary key and currently uses change tracking. Which setup gives them a history that lasts?

    Sources1123

    7.Release status of the three connectors

    The three relational database connectors have different release statuses, and the exam asks about them. SQL Server is generally available. It works in any Unity Catalog workspace that meets the requirements, with no enrollment step. MySQL and PostgreSQL are in Public Preview, and you contact your Databricks account team to enroll before using either one. For SQL Server the extra gate is the newer integrated CDC pipeline, not the connector: that feature has to be enabled by the account team. The standard gateway-based SQL Server connector does not.

    Checkpoint 9 of 10· Check yourself

    Before building anything, a platform lead lists two planned connectors for a Unity Catalog workspace: a standard gateway-based SQL Server connector and a PostgreSQL connector. Which one needs the Databricks account team involved first?

    Checkpoint 10 of 10· Exam question

    As of October 2026, which statement accurately describes the release status of Lakeflow Connect's relational database CDC connectors for SQL Server, PostgreSQL, and MySQL (using the integrated CDC pipeline, which needs no separate ingestion gateway)?

    Sources793

    Sources

    (11)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “A Unity Catalog volume that temporarily stores extracted data before it's applied to the destination table.”
      ↩︎ How a database connector moves changes: gateway, staging, pipeline
      “Data is automatically purged from staging after 30 days.”
      ↩︎ How a database connector moves changes: gateway, staging, pipeline
      “A Unity Catalog securable object that stores authentication details for the database.”
      ↩︎ How a database connector moves changes: gateway, staging, pipeline
      “Size this compute for your workload, because the initial snapshot can fail on undersized compute.”
      ↩︎ How a database connector moves changes: gateway, staging, pipeline
      “The gateway runs on classic compute, and it runs continuously to capture changes before change logs can be truncated in the source.”
      ↩︎ Key concept
      “A Unity Catalog volume that temporarily stores extracted data before it's applied to the destination table.”
      ↩︎ Exam trap 2
      “Because the ingestion gateway runs continuously, you provision and pay for its classic compute even when your ingestion pipeline is idle.”
      ↩︎ Exam trap 3
    2. 2.
      “The staging catalog cannot be a foreign catalog.”
      ↩︎ How a database connector moves changes: gateway, staging, pipeline
      “This is critical for PostgreSQL to prevent Write-Ahead Log (WAL) bloat and ensure that replication slots do not accumulate unconsumed changes.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “Logical replication is only supported on primary instances and not on read replicas.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “If history tracking is enabled, a full refresh erases that history.”
      ↩︎ Choosing SCD Type 1 or Type 2 for replicated tables
      “The PostgreSQL connector for Lakeflow Connect is in Public Preview. Reach out to your Databricks account team to enroll in the Public Preview.”
      ↩︎ Checkpoint
    3. 3.
      “an integrated CDC pipeline runs both extraction and application stages in one pipeline update.”
      ↩︎ Integrated CDC pipelines: one pipeline instead of two
      “Each pipeline update extracts changes and then stops automatically after it has caught up with the source, bounded by a maximum runtime.”
      ↩︎ Integrated CDC pipelines: one pipeline instead of two
      “Because each extraction stage runs for at least 10 minutes, an interval of 60 minutes or longer is a good starting point”
      ↩︎ Integrated CDC pipelines: one pipeline instead of two
      “An integrated CDC pipeline runs on classic or serverless compute”
      ↩︎ Integrated CDC pipelines: one pipeline instead of two
      “The pipeline skips tables without CDC or change tracking enabled on the source.”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “the orders table uses SCD Type 2 (which requires SQL Server CDC on the source)”
      ↩︎ Choosing SCD Type 1 or Type 2 for replicated tables
      “Your workspace must have the integrated CDC connector feature enabled. Contact your Databricks account team.”
      ↩︎ Release status of the three connectors
      “the orders table uses SCD Type 2 (which requires SQL Server CDC on the source)”
      ↩︎ Exam trap 4
      “You have access to the primary SQL Server instance. The integrated CDC connector does not support read replicas, standby instances, or secondary instances.”
      ↩︎ Checkpoint
    4. 4.
      “Integrated CDC pipelines for MySQL require classic compute. Serverless compute is not supported.”
      ↩︎ Integrated CDC pipelines: one pipeline instead of two
    5. 5.
      “Databricks recommends using change tracking for any table that has a primary key to minimize the load on the source database.”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “CDC doesn't require that a table have a primary key”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “To use change tracking, you must have SQL Server 2012 or above.”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “Create a database user in SQL Server that is dedicated to Databricks ingestion and meets the privilege requirements.”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “Set up the source database, including permission management, change tracking enablement, and CDC enablement.”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “If change tracking and CDC are both enabled, the SQL Server connector uses change tracking.”
      ↩︎ Prediction
    6. 6.
      “change tracking and change data capture are not supported on read replicas or secondary instances”
      ↩︎ Preparing SQL Server: change tracking or CDC, on the primary
      “change tracking and change data capture are not supported on read replicas or secondary instances”
      ↩︎ Exam trap 1
    7. 7.
      “Enable binary logging. Set the binlog format to ROW. Set the binlog row image to FULL.”
      ↩︎ Preparing MySQL: row-based binlog and a replication user
      “The connector does not support ingesting from Amazon Aurora MySQL read replicas.”
      ↩︎ Preparing MySQL: row-based binlog and a replication user
      “there might be a replication lag between the primary database and replica, which can affect data freshness.”
      ↩︎ Preparing MySQL: row-based binlog and a replication user
      “The MySQL connector is in Public Preview. Contact your Databricks account team to request access.”
      ↩︎ Release status of the three connectors
    8. 9.
      “Lakeflow Connect supports data replication from PostgreSQL version 13 and later.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “For AWS RDS and Aurora, set the rds.logical_replication parameter to 1.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “Publications must be created before creating replication slots.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “Only the replication user's credentials are stored in the Unity Catalog connection.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
      “The PostgreSQL connector for Lakeflow Connect is in Public Preview.”
      ↩︎ Release status of the three connectors
    9. 10.
      “The replication user requires SELECT privileges on system catalog tables for all PostgreSQL platforms.”
      ↩︎ Preparing PostgreSQL: publications, replication slots and two sets of credentials
    10. 11.
      “Turn history tracking off (SCD type 1) to overwrite outdated records as they're updated and deleted in the source.”
      ↩︎ Choosing SCD Type 1 or Type 2 for replicated tables
      “Deleting a table or column in the source does not delete that data from the destination, even when SCD type 1 is selected.”
      ↩︎ Choosing SCD Type 1 or Type 2 for replicated tables

    Spotted a mistake, or was something unclear? Tell us.