Azure Event Hubs as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.
Let’s look at how we can seamlessly perform Change-Data Capturing (CDC) from PostgreSQL to topics in Azure EventHubs.
Suppose you have a banking application running on PostgreSQL. There are two tables: “users” and “transactions.” You want to sync these tables in real-time to Event Hubs topics. Let’s see how we can make this happen within a few minutes and a few SQL commands using PeerDB.
Run the following commands to let PeerDB know about the existing PostgreSQL and Event Hubs Peers.
-- Connect to PeerDBpsql "port=9900 host=localhost password=peerdb"-- Add PostgreSQL and Event Hubs peersCREATE PEER postgres_peer FROM POSTGRES (...);CREATE PEER eventhubs_peer FROM EVENTHUBS (...);
Make sure to replace (…) with the appropriate connection details for both the PostgreSQL and Event Hubs instances. More details on adding Peers are available here.
Step 2: Real-Time CDC from PostgreSQL to Event Hubs
The mirror from PostgreSQL to Eventhubs is unique, in the sense that you can sync source tables across namespaces,
and you can specify a column whose values will be used to route data into the partitions of the event hub.To facilitate real-time Change Data Capture (CDC) from PostgreSQL to Event Hubs, set up your peers and then create a mirror using the following SQL syntax:
CREATE MIRROR IF NOT EXISTS <mirror-name>FROM <postgres-peer-name> TO <eventhubs-peer-name>WITH TABLE MAPPING( <source-schema>.<table>:<namespace_name>.<eventhub_name>.<partition_key_column>, ... -- Repeat as required for multiple tables)WITH( max_batch_size = <number>, publication_name = '<publication-name>');
Example:
CREATE MIRROR IF NOT EXISTS test_eh_mirrorFROM test_pg_peer TO test_eh_peerWITH TABLE MAPPING( schema1.table1:mynamespace1.hub1.id, schema1.table2:mynamespace2.hub2.id -- Add more tables as required)WITH( do_initial_copy = false, max_batch_size = 300000, publication_name = 'test_publication');
Parameters:
mirror-name: Desired name for the mirror.
postgres-peer-name: Name of the PostgreSQL peer.
eventhubs-peer-name: Name of the Event Hubs group peer.
namespace-name: Name of the namespace in which you wish to sync to an eventhub.
eventhub-name: Name of the eventhub in which you wish to sync the data. PeerDB creates the eventhub for you if it doesn’t exist already.
partition_key_column: Column in the source table whose values will be used to route data into the partitions of the event hub.
max_batch_size: Maximum number of records in a batch.
publication_name: Name of the publication.
Remember to adjust placeholder values (<…>) with your specific details and preferences.
The example above has been abbreviated for clarity; ensure you provide all the necessary mappings and configurations in practice.
You can connect to localhost:8085 to get full visibility into the different jobs and steps that PeerDB is taking under the covers to manage the MIRROR.
To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this PR.
-- drop the mirrorDROP MIRROR real_time_cdc;
{"docsConfig":{"$schema":"https://mintlify.com/docs.json","theme":"mint","name":"PeerDB Docs: Setup your ETL in minutes with SQL.","colors":{"primary":"#248736","light":"#248736","dark":"#248736"},"favicon":"https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/favicon.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=bcb6625d7fc622364e8380f49bc07790","logo":{"light":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e","dark":"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-dark.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=feffd926023e0bcf9c5d4282d426fe12"},"navbar":{"primary":{"type":"button","label":"Get Started","href":"https://app.peerdb.cloud"}},"footer":{"socials":{"github":"https://github.com/PeerDB-io"}},"integrations":{"ga4":{"measurementId":"G-1V9ZZCZMB7"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"peerdb","hasAudioNarration":false,"actualSubdomain":"peerdb","customDomains":["docs.peerdb.io"],"gitSource":{"type":"github","owner":"peerdb-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6a8893018e352becf1ac8d39","collectionId":"dc037637-3209-4796-8664-2e77fd9c1f6c","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6a8893018e352becf1ac8d39"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6a8893018e352becf1ac8d39:success","clientVersion":"0.0.4021","searchFilterCounts":[{"language":"default","tag":"Documentation","count":75},{"language":"default","tag":"Setup","count":17},{"language":"default","tag":"API Reference","count":14},{"language":"default","tag":"API Endpoints","count":14},{"language":"default","tag":"Use-cases","count":12},{"language":"default","tag":"SQL Reference","count":10},{"language":"default","tag":"SQL Commands","count":10},{"language":"default","tag":"PostgreSQL Setup Guide","count":9},{"language":"default","tag":"Features","count":9},{"language":"default","tag":"Mirror","count":9}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"usecases/real-time-cdc/postgres-to-azure-eventhubs","slug":"/usecases/real-time-cdc/postgres-to-azure-eventhubs","pageMetadata":{"title":"PostgreSQL To Azure Event Hubs","description":null,"href":"/usecases/real-time-cdc/postgres-to-azure-eventhubs"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsx(_components.p,{children:`Azure Event Hubs as a destination is deprecated and no longer actively maintained. It remains fully functional and no code is currently being removed. For new mirrors, we recommend ClickHouse, ClickHouse Cloud, or Postgres as the destination.`})}),`\n`,_jsx(_components.p,{children:`Let’s look at how we can seamlessly perform Change-Data Capturing (CDC) from PostgreSQL to topics in Azure EventHubs.`}),`\n`,_jsx(Heading,{level:`3`,id:`scenario`,children:`Scenario`}),`\n`,_jsx(_components.p,{children:`Suppose you have a banking application running on PostgreSQL. There are two tables: “users” and “transactions.” You want to sync these tables in real-time to Event Hubs topics. Let’s see how we can make this happen within a few minutes and a few SQL commands using PeerDB.`}),`\n`,_jsx(Heading,{level:`3`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Enable logical decoding in PostgreSQL. Ensure that the following settings/GUCs are properly configured:`,`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`wal_level: logical`}),`\n`,_jsx(_components.li,{children:`max_wal_senders: >1`}),`\n`,_jsx(_components.li,{children:`max_replication_slots: 4`}),`\n`]}),`\n`]}),`\n`,_jsx(_components.li,{children:`Enable replication access for a PostgreSQL user - ALTER USER pg_user REPLICATION;`}),`\n`,_jsx(_components.li,{children:`Ensure that both tables have primary keys. Composite primaries are also fine. If not, make sure your tables have REPLICA IDENTITY FULL.`}),`\n`,_jsxs(_components.li,{children:[`If you are using PostgreSQL on the cloud, below links capture how to enable logical replication for each cloud:`,`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Replication.Logical.html#AuroraPostgreSQL.Replication.Logical.Configure`,children:`AWS RDS and Aurora PostgreSQL`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://learn.microsoft.com/azure/postgresql/flexible-server/concepts-logical#pre-requisites-for-logical-replication-and-logical-decoding`,children:`Azure Database for PostgreSQL - Flexible Server`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`https://cloud.google.com/sql/docs/PostgreSQL/replication/configure-logical-replication#configure-your-postgresql-instance`,children:`GCP Cloud SQL PostgreSQL`})}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-add-postgresql-and-event-hubs-peers`,children:`Step 1: Add PostgreSQL and Event Hubs Peers`}),`\n`,_jsx(_components.p,{children:`Run the following commands to let PeerDB know about the existing PostgreSQL and Event Hubs Peers.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Connect to PeerDB`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`psql `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"port=9900 host=localhost password=peerdb\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Add PostgreSQL and Event Hubs peers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PEER postgres_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` POSTGRES (...);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` PEER eventhubs_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` EVENTHUBS (...);`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Make sure to replace `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`(…)`})}),` with the appropriate connection details for both the PostgreSQL and Event Hubs instances. More details on adding Peers are available `,_jsx(_components.a,{href:`/sql/commands/create-peer`,children:`here`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-real-time-cdc-from-postgresql-to-event-hubs`,children:_jsx(_components.strong,{children:`Step 2: Real-Time CDC from PostgreSQL to Event Hubs`})}),`\n`,_jsxs(_components.p,{children:[`The mirror from PostgreSQL to Eventhubs is unique, in the sense that you can sync source tables `,_jsx(_components.strong,{children:`across namespaces`}),`,\nand you can `,_jsx(_components.strong,{children:`specify a column whose values will be used to route data`}),` into the partitions of the event hub.`]}),`\n`,_jsx(_components.p,{children:`To facilitate real-time Change Data Capture (CDC) from PostgreSQL to Event Hubs, set up your peers and then create a mirror using the following SQL syntax:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MIRROR `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IF`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` NOT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` EXISTS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`mirror`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`postgres`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`peer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TO`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`eventhubs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`peer`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MAPPING(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`source`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`schema`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`table`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`namespace_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`eventhub_name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`partition_key_column`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ... `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- Repeat as required for multiple tables`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_batch_size `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`number`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publication_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '\u003cpublication-name>'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Example:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`CREATE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MIRROR `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IF`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` NOT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` EXISTS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` test_eh_mirror`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` test_pg_peer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`TO`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` test_eh_peer`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TABLE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MAPPING(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` schema1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`table1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`mynamespace1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`hub1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.id,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` schema1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`table2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`mynamespace2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`hub2`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.id`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- Add more tables as required`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WITH`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` do_initial_copy `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` false,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` max_batch_size `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 300000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` publication_name `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'test_publication'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Parameters:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`mirror-name`})}),`: Desired name for the mirror.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`postgres-peer-name`})}),`: Name of the PostgreSQL peer.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`eventhubs-peer-name`})}),`: Name of the Event Hubs group peer.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`namespace-name`})}),`: Name of the namespace in which you wish to sync to an eventhub.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`eventhub-name`})}),`: Name of the eventhub in which you wish to sync the data. PeerDB creates the eventhub for you if it doesn’t exist already.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`partition_key_column`})}),`: Column in the source table whose values will be used to route data into the partitions of the event hub.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`max_batch_size`})}),`: Maximum number of records in a batch.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`publication_name`})}),`: Name of the publication.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Remember to adjust placeholder values (\u003c…>) with your specific details and preferences.\nThe example above has been abbreviated for clarity; ensure you provide all the necessary mappings and configurations in practice.`}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-validate-the-mirror`,children:_jsx(_components.strong,{children:`Step 3: Validate the Mirror`})}),`\n`,_jsx(_components.p,{children:`Validate the mirror by checking if the number of messages in the topics matches the row count on the source table.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` COUNT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`*`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` postgres_peer`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`public`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.transactions;`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`step-4-monitor-the-mirror`,children:`Step 4: Monitor the MIRROR`}),`\n`,_jsxs(_components.p,{children:[`You can connect to `,_jsx(_components.code,{children:`localhost:8085`}),` to get full visibility into the different jobs and steps that PeerDB is taking under the covers to manage the MIRROR.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=a455add3d1435f5cb4eeeb4a1d8dda90`,alt:`Managing Mirror`,\"data-og-width\":`1768`,width:`1768`,\"data-og-height\":`831`,height:`831`,\"data-path\":`images/managing_mirror.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=280\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=f862e37699beeca08b45a8011569e0a6 280w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=560\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=836aa1545e9b5f20ae2433c0ec200744 560w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=840\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=da72c888007094b25a8f0a3873a12a30 840w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=1100\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=63a15f01f5ea782c193ceeca6013faf1 1100w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=1650\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=e930aa56147a73b51a3bf3524a35e8a1 1650w, https://mintcdn.com/peerdb/MRN5BST_xrBv7brJ/images/managing_mirror.png?w=2500\u0026fit=max\u0026auto=format\u0026n=MRN5BST_xrBv7brJ\u0026q=85\u0026s=d38fe97d9f35f03343ad79ad8bebcfc6 2500w`}),`\n`,_jsx(Heading,{level:`3`,id:`step-5-drop-mirror`,children:`Step 5: DROP MIRROR`}),`\n`,_jsxs(_components.p,{children:[`To make it easy in your development and test environments, PeerDB also introduces the DROP MIRROR command. DROP MIRROR drops all the underlying objects that CREATE MIRROR generates. More details are available in this `,_jsx(_components.a,{href:`https://github.com/PeerDB-io/peerdb/pull/93`,children:`PR`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- drop the mirror`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`DROP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MIRROR real_time_cdc;`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"PostgreSQL To Azure Event Hubs","description":null,"href":"/usecases/real-time-cdc/postgres-to-azure-eventhubs"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Scenario","slug":"scenario","depth":3,"children":[]},{"title":"Prerequisites","slug":"prerequisites","depth":3,"children":[]},{"title":"Step 1: Add PostgreSQL and Event Hubs Peers","slug":"step-1-add-postgresql-and-event-hubs-peers","depth":3,"children":[]},{"title":"Step 2: Real-Time CDC from PostgreSQL to Event Hubs","slug":"step-2-real-time-cdc-from-postgresql-to-event-hubs","depth":3,"children":[]},{"title":"Step 3: Validate the Mirror","slug":"step-3-validate-the-mirror","depth":3,"children":[]},{"title":"Step 4: Monitor the MIRROR","slug":"step-4-monitor-the-mirror","depth":3,"children":[]},{"title":"Step 5: DROP MIRROR","slug":"step-5-drop-mirror","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"peerdb","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","title":"PostgreSQL To Azure Event Hubs - PeerDB Docs: Setup your ETL in minutes with SQL.","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-21T18:07:54.664Z","originalFileLocation":"usecases/real-time-cdc/postgres-to-azure-eventhubs.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"PostgreSQL To Azure Event Hubs - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://peerdb.mintlify.app/_mintlify/api/og/v2?division=Real-time+Change+Data+Capture+from+Postgres\u0026amp;title=PostgreSQL+To+Azure+Event+Hubs\u0026amp;theme=fca96d2023807749157a0c65\u0026amp;signature=d47f2fde0961a78d53ab2f91e4d5b8ef3774ad4c5bb1f816f5fa17ff57daeca6\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"PostgreSQL To Azure Event Hubs - PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://peerdb.mintlify.app/_mintlify/api/og/v2?division=Real-time+Change+Data+Capture+from+Postgres\u0026amp;title=PostgreSQL+To+Azure+Event+Hubs\u0026amp;theme=fca96d2023807749157a0c65\u0026amp;signature=d47f2fde0961a78d53ab2f91e4d5b8ef3774ad4c5bb1f816f5fa17ff57daeca6\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/peerdb/AsJEjbO1FwDhXakS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"PeerDB Docs: Setup your ETL in minutes with SQL.\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#248736\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/usecases/real-time-cdc/postgres-to-azure-eventhubs.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.peerdb.io/#organization\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/logo/docs-logo-light.png?fit=max\u0026auto=format\u0026n=wtgPI5cQwjI2FO0m\u0026q=85\u0026s=90ac5de385106617a465b7ba4d33a28e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.peerdb.io#website\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"url\":\"https://docs.peerdb.io\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs#webpage\",\"url\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs\",\"name\":\"PostgreSQL To Azure Event Hubs\",\"dateModified\":\"2026-08-21T18:07:54.664Z\",\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Use-cases\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Real-time Change Data Capture from Postgres\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PostgreSQL To Azure Event Hubs\",\"item\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs#article\",\"headline\":\"PostgreSQL To Azure Event Hubs\",\"name\":\"PostgreSQL To Azure Event Hubs\",\"url\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs\",\"mainEntityOfPage\":{\"@id\":\"https://docs.peerdb.io/usecases/real-time-cdc/postgres-to-azure-eventhubs#webpage\"},\"dateModified\":\"2026-08-21T18:07:54.664Z\",\"publisher\":{\"@id\":\"https://docs.peerdb.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.peerdb.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"PeerDB Docs: Setup your ETL in minutes with SQL.\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"PeerDB Docs: Setup your ETL in minutes with SQL.","nav":{"global":null,"anchors":[{"anchor":"Documentation","icon":"book-open","groups":[{"group":"Home","pages":[{"title":"PeerDB","href":"/introduction"},{"title":"Architecture Overview","href":"/architecture"},{"title":"Why choose PeerDB over other tools?","href":"/why-peerdb"}]},{"group":"Quickstart","pages":[{"title":"Quickstart Guide","href":"/quickstart/quickstart"},{"title":"PeerDB Streams for Kafka Quickstart Guide","href":"/quickstart/streams-quickstart"},{"title":"SQL Quickstart Guide","href":"/quickstart/sql-quickstart"}]},{"group":"PeerDB Cloud","pages":[{"title":"PeerDB Cloud Quickstart Guide","icon":"rocket","iconType":"solid","href":"/peerdb-cloud/cloud-quickstart"},{"title":"PeerDB Cloud Security","icon":"lock","iconType":"solid","href":"/peerdb-cloud/cloud-security"},{"title":"PeerDB Cloud Pricing FAQ","icon":"question","iconType":"solid","href":"/peerdb-cloud/peerdb-cloud-pricing-faq"},{"title":"Trust Center","url":"https://trust.peerdb.io/","icon":"shield-halved","iconType":"solid","href":"/peerdb-cloud/cloud-trust-center"},{"title":"Public IPs For PeerDB Cloud","icon":"server","iconType":"regular","href":"/peerdb-cloud/ip-table"},{"title":"AWS Private Link","icon":"diagram-project","iconType":"solid","href":"/peerdb-cloud/aws-private-link"}]},{"group":"Setup","pages":[{"group":"PostgreSQL Setup Guide","pages":[{"title":"RDS Postgres Source Setup Guide","href":"/connect/postgres/rds_postgres"},{"title":"Supabase Postgres Source Setup Guide on PeerDB Cloud","href":"/connect/postgres/supabase_postgres_peerdb_cloud"},{"title":"Supabase Postgres Source Setup Guide","href":"/connect/postgres/supabase_postgres"},{"title":"Google CloudSQL Postgres Source Setup Guide","href":"/connect/postgres/cloudsql_postgres"},{"title":"Azure Flexible Server Postgres Source Setup Guide","href":"/connect/postgres/azure_flexible_server_postgres"},{"title":"Crunchy Bridge Postgres Source Setup Guide","href":"/connect/postgres/crunchy_bridge"},{"title":"Neon Postgres Source Setup Guide","href":"/connect/postgres/neon_postgres"},{"title":"Generic PostgreSQL Source Setup Guide","href":"/connect/postgres/generic_postgres"},{"title":"Unsupported PostgreSQL Providers","href":"/connect/postgres/unsupported_providers"}]},{"title":"CockroachDB Source Setup Guide","href":"/connect/cockroachdb"},{"group":"Clickhouse Setup Guide","pages":[{"title":"ClickHouse Cloud Setup Guide","href":"/connect/clickhouse/clickhouse-cloud"},{"title":"ClickHouse Setup Guide","href":"/connect/clickhouse/clickhouse"}]},{"title":"Snowflake Setup Guide","href":"/connect/snowflake"},{"title":"BigQuery Setup Guide","href":"/connect/bigquery"},{"title":"GCS Setup Guide","href":"/connect/gcs"},{"title":"S3 Setup Guide","href":"/connect/s3"},{"title":"Elasticsearch Setup Guide","href":"/connect/elasticsearch"}]},{"group":"Queues Setup","pages":[{"title":"Kafka Setup Guide","href":"/connect/kafka"},{"title":"Confluent Cloud Setup Guide","href":"/connect/confluent-cloud"},{"title":"PubSub Setup Guide","href":"/connect/pubsub"}]},{"group":"Mirror","pages":[{"title":"CDC Setup from Postgres to ClickHouse","href":"/mirror/cdc-pg-clickhouse"},{"title":"CDC Setup from Supabase to ClickHouse","href":"/mirror/cdc-supabase-clickhouse"},{"title":"CDC Setup from Neon Postgres to ClickHouse","href":"/mirror/cdc-neon-clickhouse"},{"title":"CDC Setup from Postgres to Bigquery","href":"/mirror/cdc-pg-bq"},{"title":"CDC Setup from Postgres to Snowflake","href":"/mirror/cdc-pg-sf"},{"title":"CDC Setup from Postgres to Postgres","href":"/mirror/cdc-pg-pg"},{"title":"CDC Setup from Postgres to Kafka","href":"/mirror/cdc-pg-kafka"},{"title":"CDC Setup from Postgres to Elasticsearch","href":"/mirror/cdc-pg-elasticsearch"},{"title":null,"href":"/mirror/upgrade"}]},{"group":"5-minute Tutorials","pages":[{"title":"Streaming Query Replication of PostgreSQL To Snowflake","href":"/tutorials/realtime-streaming-of-query-results"}]},{"group":"Features","pages":[{"title":"Pausing a CDC Mirror","href":"/features/pause-mirror"},{"title":"Editing a CDC Mirror","href":"/features/edit-mirror"},{"title":"Resyncing a CDC Mirror","href":"/features/resync-mirror"},{"title":"Schema Changes Propagation Support","href":"/features/schema-changes"},{"title":null,"href":"/features/replicating-partitioned-tables"},{"title":null,"href":"/features/feature-matrix"},{"title":null,"href":"/features/supported-connectors"},{"group":"Alerting","pages":[{"title":"Slack Alerting","href":"/features/alerting/slack-alerting"},{"title":"Email Alerting","href":"/features/alerting/email-alerting"}]}]},{"group":"Data types","pages":[{"title":null,"href":"/datatypes/datatype-matrix"}]},{"group":"Best practices","pages":[{"title":"Postgres to ClickHouse: Data Modeling Tips","href":"/bestpractices/clickhouse_datamodeling"},{"title":"Heartbeat Table For CDC","href":"/bestpractices/heartbeat"},{"title":"Upgrading the PostgreSQL Peer Of An Ongoing CDC Mirror","href":"/bestpractices/postgres-upgrade"},{"title":"Generated Columns: Gotchas and Best Practices","href":"/bestpractices/generated_columns"},{"title":"Postgres to ClickHouse: Handling TOAST Columns","href":"/bestpractices/clickhouse_toast_columns"},{"title":"Defining the Ordering Key in ClickHouse differently from the Primary Key in Postgres","href":"/bestpractices/ordering-key-different"}]},{"group":"Use-cases","pages":[{"group":"Real-time Change Data Capture from Postgres","pages":[{"title":"Overview","href":"/usecases/real-time-cdc/overview"},{"title":"PostgreSQL To PostgreSQL","href":"/usecases/real-time-cdc/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","href":"/usecases/real-time-cdc/postgres-to-bigquery"},{"title":"PostgreSQL To Snowflake","description":null,"href":"/usecases/real-time-cdc/postgres-to-snowflake"},{"title":"PostgreSQL To Azure Event Hubs","href":"/usecases/real-time-cdc/postgres-to-azure-eventhubs"},{"title":"PostgreSQL To AWS S3 And Google Cloud Storage","description":null,"href":"/usecases/real-time-cdc/postgres-to-cloud"}]},{"group":"Streaming Query Replication","pages":[{"title":"Overview","href":"/usecases/streaming-query-replication/overview"},{"title":"PostgreSQL to PostgreSQL","href":"/usecases/streaming-query-replication/postgres-to-postgres"},{"title":"PostgreSQL to BigQuery","href":"/usecases/streaming-query-replication/postgres-to-bigquery"},{"title":"PostgreSQL to S3","href":"/usecases/streaming-query-replication/postgres-to-s3"},{"title":"PostgreSQL to Snowflake","href":"/usecases/streaming-query-replication/postgres-to-snowflake"}]},{"title":"Query Federation via PostgreSQL","href":"/usecases/postgres-compatible-layer-for-bigquery-and-snowflake"}]},{"group":"Benchmarks","pages":[{"title":null,"href":"/benchmarks/benchmarking-Postgres-Replication:-PeerDB-vs-Airbyte"}]},{"group":"Contributing","pages":[{"title":"Running Flow tests","href":"/dev/running-tests"}]},{"group":"Metrics and Tuning","pages":[{"title":"Config Tuning for Change Data Capture (CDC)","href":"/metrics/important_cdc_configs"},{"title":"Native Metrics","href":"/metrics/native-metrics"}]},{"group":"FAQs","pages":[{"title":"Frequently Asked Questions","href":"/faqs/faqs"}]}]},{"anchor":"SQL Reference","icon":"rectangle-terminal","pages":[{"title":"SQL Reference","href":"/sql/reference"}]},{"anchor":"API Reference","icon":"browser","pages":[{"title":"API Reference","href":"/peerdb-api/reference"}]},{"anchor":"Lua Reference","icon":"file-code","pages":[{"title":"Lua Reference","href":"/lua/reference"}]},{"anchor":"GitHub","href":"https://github.com/PeerDB-io/peerdb","icon":"github"},{"anchor":"Changelog","href":"https://github.com/PeerDB-io/peerdb/releases","icon":"list"},{"anchor":"Community","href":"https://slack.peerdb.io","icon":"slack"}]},"title":"PostgreSQL To Azure Event Hubs - PeerDB Docs: Setup your ETL in minutes with SQL.","buildId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","deploymentId":"dpl_EnxDqhjaNc9a8MVa833TGULPd9uJ","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-CVZVK4hN.js","lightbox-handle-r17bVUz3.js"]}