Uredi

Deli z drugimi prek


Add PostgreSQL Database CDC source to an eventstream (preview)

This article shows you how to add a PostgreSQL Database Change Data Capture (CDC) source to an eventstream.

The PostgreSQL Database Change Data Capture (CDC) source connector for Microsoft Fabric event streams allows you to capture a snapshot of the current data in a PostgreSQL database. The connector then monitors and records any future row-level changes to this data. Once the changes are captured in the eventstream, you can process this CDC data in real-time and send it to different destinations within Fabric for further processing or analysis.

Important

Enhanced capabilities of Fabric event streams are currently in preview.

Note

This source is not supported in the following regions of your workspace capacity: West US3, Switzerland West.

Prerequisites

Note

The maximum number of sources and destinations for one eventstream is 11.

Enable CDC in your Azure Database for PostgreSQL

To enable CDC in your Azure Database for PostgreSQL Flexible Server, follow these steps:

  1. On your Azure Database for PostgreSQL Flexible Server page in the Azure portal, select Server parameters in the navigation menu.

  2. On the Server parameters page:

    • Set wal_level to logical.
    • Update the max_worker_processes to at least 16.

    A screenshot of enabling CDC for a flexible server deployment.

  3. Save the changes and restart the server.

  4. Confirm that your Azure Database for PostgreSQL Flexible Server instance allows public network traffic.

  5. Grant the admin user replication permissions by running the following SQL statement. If you want to use other user account to connect your PostgreSQL DB to fetch CDC, please ensure the user is the table owner.

    ALTER ROLE <admin_user_or_table_owner_user> WITH REPLICATION;
    

Add Azure Database for PostgreSQL CDC as a source

  1. Select Eventstream to create a new eventstream. Make sure the Enhanced Capabilities (preview) option is enabled.

    A screenshot of creating a new eventstream.

  2. On the next screen, select Add external source.

    A screenshot of selecting Add external source.

Configure and connect to Azure Database for PostgreSQL CDC

  1. On the Select a data source screen, select Azure DB for PostgreSQL (CDC).

    A screenshot of selecting PostgreSQL DB (CDC).

  2. On the Connect page, select New connection.

    Screenshot that shows the Connect page for an Azure PostgreSQL database with New connection link highlighted.

  3. In the Connection settings section, enter the following information.

    • Server: The server address of your PostgreSQL database, for example my-pgsql-server.postgres.database.azure.com.

    • Database: The database name, for example my_database.

      Screenshot that shows the Connection settings section for the Azure PostgreSQL database connector.

  4. Scroll down, and in the Connection credentials section, follow these steps.

    1. For Connection name, enter a name for the connection.

    2. For Authentication kind, select Basic.

      Note

      Currently, Fabric event streams supports only Basic authentication.

    3. Enter Username and Password for the database.

    4. Select Connect.

      Screenshot that shows the Connection credentials section for the Azure PostgreSQL database connector.

  5. Now, on the Connect page, do these steps:

    1. For table, Enter a table name.

    2. For Port, enter the port number or leave the default value: 5432.

    3. Select Next at the bottom of the page.

      Screenshot that shows the Connect page filled for the Azure PostgreSQL database connector.

  6. On the Review and create screen, review the summary, and then select Add.

    Screenshot that shows the Review and create page filled for the Azure PostgreSQL database connector.

You can see the PostgreSQL Database CDC source added to your eventstream in Edit mode.

A screenshot of streaming PostgreSQL DB CDC source in Edit view.

To implement this newly added PostgreSQL DB CDC source, select Publish. After you complete these steps, your PostgreSQL DB CDC source is available for visualization in the Live view.

A screenshot of streaming PostgreSQL DB CDC source in Live view.

Other connectors: