{"id":96925,"date":"2023-05-24T10:10:22","date_gmt":"2023-05-24T10:10:22","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=96925"},"modified":"2024-09-03T20:15:19","modified_gmt":"2024-09-03T20:15:19","slug":"microsoft-fabric-data-warehouse-ingestion-using-t-sql-and-more","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/microsoft-fabric-data-warehouse-ingestion-using-t-sql-and-more\/","title":{"rendered":"Microsoft Fabric: Data Warehouse Ingestion using T-SQL and more"},"content":{"rendered":"<p>.In this blog I will illustrate how we can ingest data from a blob storage to a <strong>Microsoft Fabric<\/strong> Data Warehouse using T-SQL.<\/p>\n<h2>Create a new workspace<\/h2>\n<ol>\n<li>On the left ribbon, click <em>Workspaces.<\/em><\/li>\n<li>Click the <em>New Workspace<\/em> button.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"403\" height=\"644\" class=\"wp-image-96926\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-8.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Provide a name for the workspace.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"573\" height=\"248\" class=\"wp-image-96927\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/tabela-descricao-gerada-automaticamente.png\" alt=\"Tabela\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>On advanced configuration, ensure you choose <em>Premium by Capacity,<\/em> and you need to select a capacity.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"871\" class=\"wp-image-96928\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-e.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Email\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Click the <em>Apply<\/em> button.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"158\" class=\"wp-image-96929\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-descricao-gerada-aut-2.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio\n\nDescri\u00e7\u00e3o gerada automaticamente com confian\u00e7a m\u00e9dia\" \/><\/p>\n<h2>Creating the Microsoft Fabric Data Warehouse<\/h2>\n<ol>\n<li>On the left ribbon, <em>Experiences<\/em> button, click the <em>Data Warehouse<\/em> experience.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"329\" height=\"268\" class=\"wp-image-96930\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-9.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Click the <em>Warehouse<\/em> button to create a new Warehouse<img loading=\"lazy\" decoding=\"async\" width=\"493\" height=\"190\" class=\"wp-image-96931\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-d.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/li>\n<li>Define the name<em> wwiSample<\/em> for the Data Warehouse and click <em>Create.<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"340\" height=\"245\" class=\"wp-image-96932\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-d-1.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1372\" height=\"629\" class=\"wp-image-96933\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-e-1.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Email\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<h2>Creating the schema to import the data<\/h2>\n<ol>\n<li>Click the <em>New SQL query<\/em> button.<\/li>\n<\/ol>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\">\u00a0<span style=\"color: green;\"><i>&#8211;dimension_city<\/i><\/span><br \/>\n<span style=\"color: blue;\">DROP<\/span>\u00a0<span style=\"color: blue;\">TABLE<\/span><span style=\"color: blue;\">IF<\/span>\u00a0<span style=\"color: blue;\">EXISTS<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[dimension_city]<\/span><span style=\"color: silver;\">;<\/span><\/span><\/p>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\"><span style=\"color: blue;\">CREATE<\/span>\u00a0<span style=\"color: blue;\">TABLE<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[dimension_city]<\/span><br \/>\n<span style=\"color: maroon;\">(<\/span><br \/>\n<span style=\"color: maroon;\">[citykey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[wwicityid]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[city]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[stateprovince]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[country]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[continent]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[salesterritory]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[region]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[subregion]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[location]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[latestrecordedpopulation]<\/span>\u00a0<span style=\"color: black;\"><i>[BIGINT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[validfrom]<\/span>\u00a0<span style=\"color: black;\"><i>[DATETIME2]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[validto]<\/span>\u00a0<span style=\"color: black;\"><i>[DATETIME2]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[lineagekey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><br \/>\n<span style=\"color: maroon;\">)<\/span><span style=\"color: silver;\">;<\/span> <\/span><\/p>\n<p><span style=\"color: green;\"><i>&#8211;fact_sale<\/i><\/span><\/p>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\"><span style=\"color: blue;\">DROP<\/span>\u00a0<span style=\"color: blue;\">TABLE<\/span><span style=\"color: blue;\">IF<\/span>\u00a0<span style=\"color: blue;\">EXISTS<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[fact_sale]<\/span><span style=\"color: silver;\">;<\/span><\/span><\/p>\n<p><span style=\"font-family: Courier New; font-size: 10pt;\"><span style=\"color: blue;\">CREATE<\/span>\u00a0<span style=\"color: blue;\">TABLE<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[fact_sale]<\/span><br \/>\n<span style=\"color: maroon;\">(<\/span><br \/>\n<span style=\"color: maroon;\">[salekey]<\/span>\u00a0<span style=\"color: black;\"><i>[BIGINT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[citykey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[customerkey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[billtocustomerkey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[stockitemkey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[invoicedatekey]<\/span>\u00a0<span style=\"color: black;\"><i>[DATETIME2]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[deliverydatekey]<\/span>\u00a0<span style=\"color: black;\"><i>[DATETIME2]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[salespersonkey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[wwiinvoiceid]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[description]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[package]<\/span>\u00a0<span style=\"color: black;\"><i>[VARCHAR]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">8000<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[quantity]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[unitprice]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">18<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">2<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[taxrate]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">18<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">3<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[totalexcludingtax]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">29<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">2<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[taxamount]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">38<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[profit]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">18<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">2<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[totalincludingtax]<\/span>\u00a0<span style=\"color: black;\"><i>[DECIMAL]<\/i><\/span><span style=\"color: maroon;\">(<\/span><span style=\"color: black;\">38<\/span><span style=\"color: silver;\">,<\/span>\u00a0<span style=\"color: black;\">6<\/span><span style=\"color: maroon;\">)<\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[totaldryitems]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[totalchilleritems]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[lineagekey]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[month]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[year]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><span style=\"color: silver;\">,<\/span><br \/>\n<span style=\"color: maroon;\">[quarter]<\/span>\u00a0<span style=\"color: black;\"><i>[INT]<\/i><\/span>\u00a0<span style=\"color: blue;\">NULL<\/span><br \/>\n<span style=\"color: maroon;\">)<\/span><span style=\"color: silver;\">;<\/span> <\/span><\/p>\n<ol>\n<li>Click the <em>Run<\/em> button.<\/li>\n<\/ol>\n<p>The Data Warehouse has full DDL support to prepare tables for data ingestion or create table aggregations.<\/p>\n<ol>\n<li>On the Explorer, open <em>Schemas-&gt;dbo-&gt;Tables<\/em><\/li>\n<li>Click the three dots on the right and select <em>Refresh.<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"227\" height=\"91\" class=\"wp-image-96935\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-w.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Word\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"303\" height=\"637\" class=\"wp-image-96936\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-descricao-gerada-aut-3.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Double click the query in the top of the window and give it a new name, <em>Create Tables<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"330\" height=\"81\" class=\"wp-image-96937\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-d-2.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>You will be able to see your query on the left side, in the <em>Explorer.<\/em><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"296\" height=\"145\" class=\"wp-image-96938\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-10.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente com confian\u00e7a m\u00e9dia\" \/><\/p>\n<p>The Queries area in the explorer is like the queries in datamarts, but in the Data Warehouse we have the <em>Shared Queries<\/em>, allowing us to create a distinction between our personal queries and queries shared with other users.<\/p>\n<p>You can move a query to <em>Shared Queries<\/em> by clicking the 3 dots and selecting the option <em>Move to Shared Queries<\/em><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"138\" class=\"wp-image-96939\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-11.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<h2>Ingesting the data<\/h2>\n<p>We can use the COPY statement to ingest the data from an Azure Blog Storage to the data warehouse.<\/p>\n<p>This is the COPY statement syntax:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"483\" class=\"wp-image-96940\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/texto-descricao-gerada-automaticamente.png\" alt=\"Texto\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p>The copy statement is capable of:<\/p>\n<ul>\n<li>Load data from Blob Storage or ADLS Gen 2<\/li>\n<li>Load Parquet or CSV data<\/li>\n<li>Connect to secure resources using Credential<\/li>\n<\/ul>\n<p>Many features documented for the COPY INTO statement for Synapse also work with Synapse Data Warehouse inside <strong>Microsoft Fabric. <\/strong><a href=\"https:\/\/learn.microsoft.com\/en-us\/sql\/t-sql\/statements\/copy-into-transact-sql?view=azure-sqldw-latest\">You can discover more about COPY INTO here<\/a><\/p>\n<ol>\n<li>Click the button <em>New SQL Query<\/em><\/li>\n<li>Paste the following code in the new query window:<\/li>\n<\/ol>\n<div><span style=\"font-family: Courier New; font-size: 10pt;\"> COPY\u00a0<span style=\"color: blue;\">INTO<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[dimension_city]<\/span>\u00a0<span style=\"color: blue;\">FROM<\/span>\u00a0<span style=\"color: red;\">&#8216;https:\/\/azuresynapsestorage.blob.core.windows.net\/sampledata\/WideWorldImportersDW\/tables\/dimension_city.parquet&#8217;<\/span>\u00a0<\/span><\/div>\n<div><span style=\"font-family: Courier New; font-size: 10pt;\"><span style=\"color: blue;\">WITH<\/span>\u00a0<span style=\"color: maroon;\">(<\/span><span style=\"color: maroon;\">file_type<\/span>\u00a0<span style=\"color: silver;\">=<\/span>\u00a0<span style=\"color: red;\">&#8216;PARQUET&#8217;<\/span><span style=\"color: maroon;\">)<\/span><span style=\"color: silver;\">;<\/span><\/span><\/div>\n<div><\/div>\n<div><span style=\"font-family: Courier New; font-size: 10pt;\">COPY\u00a0<span style=\"color: blue;\">INTO<\/span>\u00a0<span style=\"color: maroon;\">[dbo]<\/span><span style=\"color: silver;\">.<\/span><span style=\"color: maroon;\">[fact_sale]<\/span>\u00a0<span style=\"color: blue;\">FROM<\/span>\u00a0<span style=\"color: red;\">&#8216;https:\/\/azuresynapsestorage.blob.core.windows.net\/sampledata\/WideWorldImportersDW\/tables\/fact_sale.parquet&#8217;<\/span><\/span><\/div>\n<div><span style=\"font-family: Courier New; font-size: 10pt;\">\u00a0<span style=\"color: blue;\">WITH<\/span>\u00a0<span style=\"color: maroon;\">(<\/span><span style=\"color: maroon;\">file_type<\/span>\u00a0<span style=\"color: silver;\">=<\/span>\u00a0<span style=\"color: red;\">&#8216;PARQUET&#8217;<\/span><span style=\"color: maroon;\">)<\/span><span style=\"color: silver;\">;<\/span> <\/span><\/div>\n<p>This storage is a public storage provided by Microsoft<\/p>\n<ol>\n<li>Click the Run button.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1385\" height=\"470\" class=\"wp-image-96941\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-e-2.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Email\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p>The result is 50 million of records loaded in 1min and 26 seconds. Not bad.<\/p>\n<ol>\n<li>Rename the query to <em>Loading Data<\/em><\/li>\n<\/ol>\n<h2>Building the Model<\/h2>\n<p>The Data Warehouse allows us to create a model which will be shared by all datasets created from the data warehouse. This is similar with the creation of a model in a <strong>Power BI Datamart<\/strong>.<\/p>\n<ol>\n<li>On the tabs under the explorer, click the <em>Model<\/em> tab.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"254\" height=\"45\" class=\"wp-image-96942\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/word-image-96925-17.png\" \/><\/p>\n<ol>\n<li>Link the <em>fact_table<\/em> with the <em>dimension_city<\/em> by <em>CitKey<\/em> field, dragging and dropping the field from the <em>fact_table<\/em> to the dimension city.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1081\" height=\"494\" class=\"wp-image-96943\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-descricao-gerada-aut-4.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>The <em>Create Relationship<\/em> window will be, in general, correct, you only need to click the <em>Confirm<\/em> button.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"580\" class=\"wp-image-96944\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-e-3.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Email\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"321\" class=\"wp-image-96945\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/uma-imagem-contendo-diagrama-descricao-gerada-aut-2.png\" alt=\"Uma imagem contendo Diagrama\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<h2>Creating a Report<\/h2>\n<p>The data warehouse is completely integrated with Power BI. All the data is stored in <strong>OneLake<\/strong>, as explained in the article <a href=\"https:\/\/www.red-gate.com\/simple-talk\/cloud\/azure\/data-intelligence-on-light-speed-microsoft-fabric\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.red-gate.com\/simple-talk\/cloud\/azure\/data-intelligence-on-light-speed-microsoft-fabric\/<\/a><\/p>\n<p>Power BI reports access the data in the <strong>OneLake<\/strong> using a technology called <strong>Direct Lake<\/strong>, which is faster than usual technologies to connect to SQL or Datalakes, either using <strong>Import<\/strong> or <strong>Direct Query<\/strong>.<\/p>\n<ol>\n<li>Click the button <em>New Report<\/em> on the top of the window.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"75\" class=\"wp-image-96946\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/uma-imagem-contendo-logotipo-descricao-gerada-aut.png\" alt=\"Uma imagem contendo Logotipo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<p>The data window on the right side of the screen brings the tables with the relationship already stablished according to the model.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"183\" height=\"147\" class=\"wp-image-96947\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-12.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente com confian\u00e7a m\u00e9dia\" \/><\/p>\n<ol>\n<li>On the visualization pane, select <em>Arcgis Maps<\/em> for Power BI<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"215\" height=\"307\" class=\"wp-image-96948\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-word-de.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo, Word\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Drag the <em>StateProvince<\/em> field from the <em>dimension_city<\/em> to the Location box in the Visualizations bar.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"416\" class=\"wp-image-96949\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-13.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Move the Profit field from the fact_sale to the Size box in the visualization bar.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"453\" height=\"373\" class=\"wp-image-96950\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-tabela-descricao-ge.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Tabela\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Resize the Arcgis visual to fill the report area.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1081\" height=\"683\" class=\"wp-image-96951\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/mapa-descricao-gerada-automaticamente.png\" alt=\"Mapa\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Click the File -&gt; Save menu.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"229\" height=\"270\" class=\"wp-image-96952\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-aplicativo-descrica-14.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>Type the name <em>Profit by Region<\/em> and click the <strong>Save<\/strong> button.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"342\" height=\"257\" class=\"wp-image-96953\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-d-3.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<ol>\n<li>On the left bar, click<em> DataWarehouseSimple<\/em> to return to a Workspace view.<\/li>\n<\/ol>\n<h1><img loading=\"lazy\" decoding=\"async\" width=\"68\" height=\"214\" class=\"wp-image-96954\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-c.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, chat ou mensagem de texto\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/h1>\n<p>Besides the data warehouse and the report, you created, the model created in the data warehouse was saved as a dataset.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1009\" height=\"338\" class=\"wp-image-96955\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2023\/05\/interface-grafica-do-usuario-texto-aplicativo-e-4.png\" alt=\"Interface gr\u00e1fica do usu\u00e1rio, Texto, Aplicativo, Email\n\nDescri\u00e7\u00e3o gerada automaticamente\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>On this blog, you found a walkthrough to create a data warehouse, load from a blob storage using T-SQL, create the modelling and build a report.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>.In this blog I will illustrate how we can ingest data from a blob storage to a Microsoft Fabric Data Warehouse using T-SQL. Create a new workspace On the left ribbon, click Workspaces. Click the New Workspace button. Provide a name for the workspace. On advanced configuration, ensure you choose Premium by Capacity, and you&#8230;&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":103113,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[137091,2,159164,159166],"tags":[123645,158997,101611,124953],"coauthors":[6810],"class_list":["post-96925","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-blogs","category-microsoft-fabric","category-powerbi","tag-data-warehouse","tag-microsoft-fabric","tag-power-bi","tag-synapse"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/96925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=96925"}],"version-history":[{"count":7,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/96925\/revisions"}],"predecessor-version":[{"id":103114,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/96925\/revisions\/103114"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media\/103113"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=96925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=96925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=96925"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=96925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}