[Preview] bc2adls and Fabric Open Mirroring

[Preview] bc2adls and Fabric Open Mirroring

At the end of last year the Microsoft Fabric team introduced the feature of Open Mirroring inside Microsoft Fabric.
Accelerate app innovation with an AI-powered data platform | Microsoft Fabric Blog

With Open Mirroring you can create your own mirroring database inside Fabric. There was already the capability to use mirroring for Azure SQL, Snowflake, CosmoDB and PostgreSQL. But now you can extend it with your own application.

In that case you have only to put your files into the “Landing Zone” and Fabric will do the processing.

This was all based on .parquet files. A couple of weeks ago also the .csv file format is supported.
Open Mirroring UI enhancements and CSV support to help you get started today | Microsoft Fabric-blog | Microsoft Fabric
And that is a good thing. In that case the BC2ADLS tool for exporting data to Microsoft Fabric can also use it. So no need for running a notebook anymore. Fabric will do the CDC processing for you.
The benefit is then that you can use the data faster!
Open Mirroring (Preview) – Microsoft Fabric | Microsoft Learn

BC2ADLS support

Please mention that this feature is still in preview in bc2adls but also in Microsoft Fabric!
In the following version of bc2adls it is implemented:
Release 26.32 · Bertverbeek4PS/bc2adls
If you have any feedback just create a issue on the GitHub repo and we will follow that.

In bc2adls there is a new option added to support the open mirroring:

Also here you can setup your Landing Zone string (which you can copy from the Open Mirroring page in Microsoft Fabric).
The rest of the authentication is the same as the regular integration with Microsoft Fabric. See also:
BC2ADLS: MS Fabric enabled part 1 – Discover Microsoft Business Central
BC2ADLS: MS Fabric enabled part 2 – Discover Microsoft Business Central

Metadata

First you need to create the _metadata.json file by exporting the “Schema Export” in bc2adls. This will tell Open Mirroring how the structure will be for this table:

{
    "keyColumns": [
        "systemId-2000000000",
        "$Company"
    ],
    "SchemaDefinition": {
        "Columns": [
            {
                "Name": "Code-1",
                "DataType": "String"
            },
            {
                "Name": "Description-5",
                "DataType": "String"
            },
            {
                "Name": "CalcPmtDisconCrMemos-6",
                "DataType": "Boolean"
            },
            {
                "Name": "LastModifiedDateTime-8",
                "DataType": "DateTimeFormat"
            },
            {
                "Name": "timestamp-0",
                "DataType": "Int"
            },
            {
                "Name": "systemId-2000000000",
                "DataType": "String"
            },
            {
                "Name": "SystemCreatedAt-2000000001",
                "DataType": "DateTimeFormat"
            },
            {
                "Name": "SystemCreatedBy-2000000002",
                "DataType": "String"
            },
            {
                "Name": "SystemModifiedAt-2000000003",
                "DataType": "DateTimeFormat"
            },
            {
                "Name": "SystemModifiedBy-2000000004",
                "DataType": "String"
            }
        ]
    },
    "fileFormat": "csv"
}

RowMarker

Then you can just export the files. If you look closer there is also a column __rowMarker__ added at the end (In a couple of weeks you can also please it in front of it).

With the __RowMarker__ column Fabric knows what to do with it:
– 0 is for inserts
– 1 is for updates
– 2 is for deletes
– 4 is for upserts (which in bc2adls we are not using)
Open Mirroring (Preview) Landing Zone Requirements and Formats – Microsoft Fabric | Microsoft Learn

Be aware that also the file name must be in a 20 digit format and must be in a continuous number. If you do a reset of the table the number will also be reset!

Inside Mirroring Database

In Microsoft Fabric you can see the process if everything is correctly:

You can see here all the uploaded files but also the status of that specific table and how many rows he replicated (be aware this is not the amount of records that is in the table!)

Then when you want to see the data just go to the “SQL analytics endpoint” and run the sql commandlet:

All the data that is in Business Central is now also in Microsoft Fabric without running the a notebook script to process the delta’s!

19 COMMENTS

Stefan Nyberg

Nice!
But you still need to run/schedule the Business Central Export but you don’t need to schedule the Notebook execution, right?
/Stefan

    Bert Verbeek

    Indeed Stefan. You only need to schedule it in Business Central indeed. And in Fabric you don’t need to run the notebook.
    Fabric will take it.

Stefan Nyberg

Will records from all Companies end up in the same Mirrored Database table “folder” and the same SQL Endpoint as well? The result is that records from several Companies are migrated?

    Bert Verbeek

    Yes indeed. If you have multiple companies alle the records will be in the same table.
    There is a column $Company from which company it is coming from.

Gijs Timmers

Thanks for the nice blog Bert!

    Bert Verbeek

    Thanks!

Nikolaj Andersen

Nice Blog, Thanks!

I see it can handle multiple Companies, how about multiple Environments or Tenants?
Would you have 2 seperate workspaces or how do you handle this?

    Bert Verbeek

    Hi Nikolaj,
    Mostly I would suggest two different lakehouses.
    In Fabric you then can combine it if you want it.
    But all in the same workspace.

Remco Nicolai

Hi Bert,

Perfect solution thanks. Just one remark. Is it possible to remove the additional numbers from the table and column names?

    Bert Verbeek

    Hi Remco,
    In the latest release you have an option to remove the numbers from the tables and the columns.

Stefan Nyberg

Hi Bert,
Where can you specify to remove the numbers?
Thx,
Stefan

    Bert Verbeek

    In the newest release there is an option called “IDs for Duplicates Only”
    You can use this option to remove the numbers.

Stefan Nyberg

Hi Bert,
One more question regarding the modification of the schema, eg. adding a new column to be pushed to Fabric :-). I understand that you have to manually remove the table and the table folder in Fabric in order to get the new column added to all records.
Do you know if this process is covered in any documentation regarding what steps to take to get this done?
Regards,
Stefan

    Bert Verbeek

    Hi Stefan,
    My next thing to do it create a better documentation :).
    I hope I can fix that by the end of the year.

    But for schema changes you need the following:
    – Clear export schema date
    – change the schema
    – reset the tables that are changes
    – Remove the tables in Fabric
    – export the schema
    – export the data.

dataguy

Hi Bert,

Is there any documentation about the settings I have on the right side in the extension?
Currently i have activated “IDs for Duplicates Only”. But I have all the IDs to every column in fabric in the mirrored database.

Version 26.36.0.0 is installed in BC

And you mentioned to delete the tables in fabric. Does this not happen automatically when I reset the table in the extension already?

dataguy

When I used the option “Use Caption” + “IDs for Duplicates Only” it works as expected. Can’t I use the IDs for Duplicates Only Option alone, when I want to grab the original column names?

    Bert Verbeek

    Hi,
    Ok then I have to look into a fix. Because if you use IDs for duplicates Only that should also work alone!
    Hopefully I can look at this next week.

    Also there is an option in bc2adls for deleting tables. If you run the notebook script then it wil indeed also the table in Fabric.

    Sorry need to update the documentation. That is on the roadmap and hopefully ready before the year end.

Carsten Eilers

Are the tables mirrored from BC locked when the job is running? Is it critical to start the job for exporting tables with large deltas when the tables are in use in Business Central?

    Bert Verbeek

    The tables are not locked by exporting.
    But the initial load I would advice after business hours.
    But the delta loads can in the business hours. Those are really small and fast.

Leave a Reply

Your email address will not be published. Required fields are marked *