Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
VickyDev18
Advocate II
Advocate II

Import CDM folders using Notebooks in Fabric

I have data synced from D365 to data lake in a CDM (Common Data Model) format. With CDM format the data files are in csv format but the metadata (column information) is stored in a separate json file. 

 

I am able to import CDM folders to a warehouse using DataFlow Gen2 as there is an option where we can specifiy that the folder is in a CDM format.  However, I would like to know how to do it using Fabric Notebooks though as they are more flexible and perform better. 

Note : I am able to import the csv file but without the column header information. I want to import with the column header information without having to created the table in advance or having to explicitly code in all the column header names. 

 

How exactly do I get a notebook to recognize that I am importing a CDM folder and make it load it with the header information?

1 REPLY 1
Anonymous
Not applicable

Hi @VickyDev18 ,

 

Maybe you can try below code in notebook:

%%sql
-- Define the CDM folder path
SET @cdmFolderPath = 'C:\\Users...';

-- Define the format of CDM files
SET @fileFormat = 'CDM';

-- Define the format of data files in the CDM folder (CSV in this case)
SET @filePattern = '*.csv';

-- Use OPENROWSET to query the CDM folder
SELECT *
FROM OPENROWSET(
    BULK CONCAT(@cdmFolderPath, @filePattern),
    FORMAT='CDM',
    PARSER_VERSION='1.0',
    FIELDTERMINATOR=',',
    FIRSTROW=2 -- Skip the header row as it's included in the metadata
) AS [Result];

vkongfanfmsft_0-1706863108098.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors