Forum Discussion
Load data from snowflake into Semantic Model using TOM and C#
- 1 year ago
Wanted to update the thread with a solution that worked for me. I followed this guide: https://www.azureguru.net/autogenerate-semantic-model-using-tabular-object-model-for-a-fabric-workspace
which was helpful in resolving my problem.
These are the M expressions I used for Snowflake and Databricks in conjunction with the above article:// your inputs string workspaceHost = "host.azuredatabricks.net"; // replace accordingly if google or aws string warehouseId = "/sql/1.0/warehouses/warehouse_ID"; string catalogName = "health_care_sanity_payment"; string databaseName = "payment_info"; string schemaName = "payment_info"; string tableName = "payments"; // build the M expression with interpolation string mExpression = $@" let host = ""{workspaceHost}"", warehouse = ""{warehouseId}"", catalog = ""{catalogName}"", database = ""{databaseName}"", schema = ""{schemaName}"", table = ""{tableName}"", Source = Databricks.Catalogs(host, warehouse, [Catalog = catalog, Database = database]), payment_data = Source{{[Item=table, Schema=schema, Catalog=catalog]}}[Data] in payment_data";// your inputs string account = "your_account_identifier.region.snowflakecomputing.com"; string warehouse = "YOUR_WAREHOUSE_NAME"; string database = "YOUR_DATABASE_NAME"; string schema = "YOUR_SCHEMA_NAME"; string table = "YOUR_TABLE_NAME"; string mExpression = $@" let Source = Snowflake.Databases(""{account}"", ""{warehouse}"", [Implementation = ""2.0""]), {database}_Database = Source{{[Name = ""{database}"", Kind = ""Database""]}}[Data], {schema}_Schema = {database}_Database{{[Name = ""{schema}"", Kind = ""Schema""]}}[Data], {table}_Table = {schema}_Schema{{[Name = ""{table}"", Kind = ""Table""]}}[Data] in {table}_Table";
Hi sresan477
Thank you for being part of the Microsoft Fabric Community.
You are correct that programmatically loading data from Snowflake into a Semantic Model (using TOM and C#) in Import mode can be challenging, and empty tables or missing data usually indicate either a connection misconfiguration or an unsupported approach.
The Tabular Object Model (TOM) manages semantic model objects, but actual data import is handled through defined data sources and requires explicit process operations (ProcessFull, ProcessData, etc.). Snowflake is supported as a data source for semantic models in Power BI and Fabric, but programmatic connections in TOM must use the native Power Query/M connector (not legacy ODBC). Use MPartitionSource in your partition definition and make sure your M query is correct and returns data.
Please do folow the below steps:
Create a Data Source in the model using the M (Power Query) Snowflake connector.
Define a Table with a partition that references the M data source.
Process the Table/Partition using ProcessFull to load data into the semantic model.
Common reasons for empty tables include forgetting to call ProcessFull or ProcessData after table creation, issues with the M query or connector string, and insufficient permissions or an unsupported authentication method.
References:
If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.
- sresan4771 year agoFrequent Visitor
thanks for the response. I have tried the following method and have gotten the same result. The table is being created but there are no columns or rows in it. Before loading the columns, I even included a check which queried the snowflake db for current session info to make sure that the connection is being established. That query worked just fine.