Piezīmes
Lai piekļūtu šai lapai, ir nepieciešama autorizācija. Varat mēģināt pierakstīties vai mainīt direktorijus.
Lai piekļūtu šai lapai, ir nepieciešama autorizācija. Varat mēģināt mainīt direktorijus.
Applies to: ✅ Warehouse in Microsoft Fabric
This article provides two examples that show how to create a new table in Fabric Data Warehouse, from a parquet file or through the warehouse editor in the Fabric portal.
Prerequisites
To get started, you must complete the following prerequisites:
- Have access to a Warehouse item within a Premium capacity workspace with contributor or higher permissions.
- Be sure to connect to your warehouse item. You cannot create tables directly in the SQL analytics endpoint of a warehouse.
- Choose your query tool. This tutorial features the SQL query editor in the Microsoft Fabric portal, but you can use any T-SQL querying tool.
For more information on connecting to your Warehouse in Microsoft Fabric, see Connectivity.
Create a blank table in the SQL query editor with templates
In the warehouse editor ribbon, locate the SQL templates dropdown list.
Select New table, and an autogenerated CREATE TABLE script template appears in your new SQL query window.
Update the table name and column definitions in the
CREATE TABLEtemplate to match the structure you need. Your T-SQL script should look similar to the following code:CREATE TABLE [dbo].[bing_covid] ( id int, updated date, confirmed int, confirmed_change int, deaths int, deaths_change int, recovered int, recovered_change int, latitude float, longitude float, iso2 varchar(2), iso3 varchar(3), country_region varchar(60), admin_region_1 varchar(60), iso_subdivision varchar(30), admin_region_2 varchar(60), load_time datetime2(6) );Select Run to create the table.
To learn more about supported table creation in Warehouse in Microsoft Fabric, see Tables in data warehousing in Microsoft Fabric and Data types in Microsoft Fabric.
Create a loaded table in the SQL query editor from an external file
You can also create a table directly from an external parquet file that you have access to. In this example, we'll create a new table based on a publicly available data file. In the query editor, paste and run the following T-SQL code:
CREATE TABLE dbo.bing_covid AS
SELECT *
FROM OPENROWSET(BULK 'https://pandemicdatalake.blob.core.windows.net/public/curated/covid-19/bing_covid-19_data/latest/bing_covid-19_data.parquet');
The CTAS (Create Table As Select) statement creates a new table and populates it with data retrieved from the specified source file, streamlining the process of both defining and loading the table in a single step. You can find more ingestion options in Ingest data with T-SQL page.