Real-time Analytics: Streaming SQL Server Data to Fabric using Debezium


Introduction/What

This article draws a method to stream data in real-time from SQL Server to Fabric using Debezium, enabling real-time replication based on events, similar to Synapse Link.

Why

Why do we need real-time analytics? That's a question best answered by the customers who demand it. The objective is to meet this demand with little coding.

How

To achieve this, I explored various solutions and found a valuable approach shared by Alexander. He demonstrated how to bring SQL Server data to Azure Hub using Debezium and was kind enough to share his script, which I modified slightly for my purpose (Here).

SQL Server to Event Hub using Debezium

  1. init.sql: This script prepares tables in CDC mode for real-time data streaming.
  2. environment.ps1: This script sets up the necessary variables. Use the variables as per your requirements.
  3. container 2_3.ps1: the script has all the commands for pulling a container and inserting the config into the REST endpoint. Al Tables in the "table.include.list" will move to the 'transmute' topic. I consume only one topic in KSQL *Important: I don't want to work with many many topics/ eventhubs.

result

Event-hub to KSQLDB

First Try: Event Hub to Event Stream

Unfortunately, the JSON format of Debezium proved incompatible, failing.

Second Try: Event Hub to KSQLDB

It was necessary to consider the input as text to read in KSQLDB. Below are the step-by-step instructions:

1.>Connect EventHub to KSQL DB: Follow the instructions provided here.

Event Hub namespaces: your link.

Event Hub: transmute.

Share Access Key Name: your Key Name.

Share Access Key: your key.

Data format: TXT

*Important: If I choose another option I will get an error.


2.>Create Materialized Views: Create materialized views for easy use (view this query in 4.query realtime.ksql).

//Stock
.create materialized-view 
with (backfill=true, effectiveDateTime=datetime(2019-01-01)) Stock1  
on table even5 
{
even5
| where payload_source.table == "Stock" and payload_op <> ""
| project this = iif(payload_op=="d", payload_before, payload_after),payload_op,payload_ts_ms
| summarize arg_max(payload_ts_ms, this.Price, payload_op) by tostring(this.Stock_Code) 
}

//Customer
.create materialized-view 
with (backfill=true, effectiveDateTime=datetime(2019-01-01)) Customer1  
on table even5 
{
even5
| where payload_source.table == "CUSTOMER" and payload_op <> ""
| project this = iif(payload_op=="d", payload_before, payload_after),payload_op,payload_ts_ms
| summarize arg_max(payload_ts_ms, this.Name, payload_op) by tostring(this.Customer_Code) 
}        

3:>Consume a Real-time Table in Power BI: Once the above steps are complete, you can consume a real-time table in Power BI by using materialized views. In this example below: Customer1, Stock1.

Conclusion

I can efficiently achieve real-time analytics with minimal coding with Fabric through Debezium.

[Thanks to Huy ??ng for the information in this post]



要查看或添加评论,请登录

Nghia Tran的更多文章

  • Microsoft Fabric Licensing Calculator

    Microsoft Fabric Licensing Calculator

    Updated image Full Link

  • RLS in Microsoft Fabric Dataset

    RLS in Microsoft Fabric Dataset

    Some limitations of Direct Lake in its current Public Preview state include the inability to create row-level security…

  • Power BI Custom Connector: Build a Module's Lineage View

    Power BI Custom Connector: Build a Module's Lineage View

    What The scenario we are dealing with is as follows: Power Query connectors do not support Lineage View in Visual…

    4 条评论
  • DBT in Microsoft Fabric: MY JOURNAL

    DBT in Microsoft Fabric: MY JOURNAL

    Update 20231114: Git Installs on Runtime 1.2 (link) - thanks venkims fromMS.

    2 条评论
  • Microsoft Fabric With dbt

    Microsoft Fabric With dbt

    UPDATE 2023-06-28: You can find more complete detailed and optimized examples for this content in the DBT in Microsoft…

  • Dynamic format strings in Power BI

    Dynamic format strings in Power BI

    V?n ?? Các báo cáo tài chính c?a Vi?t Nam th??ng có con s? r?t l?n t? ??n vài nghìn t?, do v?y h? th??ng có nhu c?u…

    1 条评论
  • Load Azure to Snowflake by dbt

    Load Azure to Snowflake by dbt

    V?n ?? Sau khi d? li?u ???c trích xu?t t? các Datasource và ???c ?áp xu?ng Azure Data Lake. Ta c?n ??a d? li?u t? Lake…

    1 条评论
  • Camera AI và Power BI ?? theo d?i k? n?ng c?a nhan viên real-time.

    Camera AI và Power BI ?? theo d?i k? n?ng c?a nhan viên real-time.

    M?c tiêu Data Team xay d?ng 1 ??a ?i?m ?? nhan viên có th? xem th?ng tin k? n?ng mà mình ?? h?c khi tham gia các l?p…

  • Auto refresh data in Power BI Desktop

    Auto refresh data in Power BI Desktop

    Power BI Desktop là phiên b?n Free cho phép chúng ta k?t n?i/x? ly/ v? bi?u ?? chia s? file ??n cho ng??i khác. Nh?ng…

    3 条评论
  • Data Governance: Audit Power BI Tenant Settings

    Data Governance: Audit Power BI Tenant Settings

    Gi?i thi?u Bài vi?t này s? cung c?p cho b?n h??ng d?n t?ng b??c v? cách l?y + ki?m tra các c?u hình d?ch v? Power BI và…

社区洞察

其他会员也浏览了