Announcing Data virtualization with Azure SQL Managed Instance – preview

Published Mar 08 2022 07:57 AM 8,398 Views
Microsoft

Challenges with data are common across industries: there’s more and more data; it needs to be analyzed faster than ever; and it’s coming in an increasing variety of formats. To respond to the challenges, organizations are looking for cost-efficient and reasonably fast ways to modernize their data platform and make it more flexible and future ready.  In many cases the preferred approach is the one allowing you to achieve the goals while using data engine you’re familiar with and the language, frameworks, and tools of your choice.

 

Data virtualization capabilities, now in preview in Azure SQL Managed Instance, enable you to execute Transact-SQL (T-SQL) queries against data from files stored in Azure Data Lake Storage Gen2 or Azure Blob Storage and combine it with relational data stored locally in the managed instance using logical joins. This way you can transparently access external data while keeping it in its original format and location. There is no data duplication or need to run and maintain ETL processes, which means that you can extract and deliver insights faster. Currently supported file formats are Parquet, CSV, and JSON.

 

When to use data virtualization

Typical use cases for data virtualization include:

 

  • Providing always up-to-date relational abstraction on top of your raw or disparate data without relocating or transforming it. This way any application capable of running T-SQL queries can consume the data: from BI solutions like Power BI, to line of business applications, to client tools like SQL Server Management Studio or Azure Data Studio. This is an easy and elegant way to expand the list of data sources for your operational reporting solutions.
  • Reducing managed instance storage consumption and total cost of ownership (TCO) by archiving cold data to Azure Data Lake Storage, keeping it still within the reach of interactive queries and joins.
  • Exploratory data analysis of data sets stored in the most common file formats. This approach is typically used by data scientists and data analysts to collect insights about the data set, from basic ones like number and structure of records, to extracting important variables, detecting outliers and anomalies, and testing underlying assumptions.

 

Figure 1 - Querying Azure Data Lake Storage files from Azure SQL Managed Instance via T-SQL queriesFigure 1 - Querying Azure Data Lake Storage files from Azure SQL Managed Instance via T-SQL queries

There are also scenarios that don’t fall into data virtualization category but can benefit from ability to query files using T-SQL. For example, inserting results of an external query to a local table can simplify existing ETL pipelines or even remove the need for dedicated data integration tools.

 

Getting started

If you are familiar with PolyBase feature of SQL Server, you may have already recognized the scenarios and underlying concepts. Data virtualization capabilities of Azure SQL Managed Instance use the same syntax as PolyBase and enrich it further with new options. PolyBase queries running on your SQL Server instance and targeting files stored in Azure Data Lake Storage or Blob Storage will continue working on your managed instance with minimal intervention to specify location prefix corresponding to the type of external source and endpoint, like abs:// instead of the generic https:// location prefix.

 

To enable data virtualization capabilities on your managed instance, run the following commands:

 

exec sp_configure 'polybase_enabled', 1;
go
reconfigure;
go

 

For simplicity, we are going to use publicly available Bing COVID-19 dataset that allows anonymous access.

First, create external data source encapsulating data related to the file location:

 

CREATE EXTERNAL DATA SOURCE DemoPublicExternalDataSource
WITH (
	LOCATION = 'abs://public@pandemicdatalake.blob.core.windows.net/curated/covid-19/bing_covid-19_data/latest' 
)

 

You’re now ready to run the first query:

 

--Number of confirmed Covid-19 cases per country/territory during 2020:
SELECT countries_and_territories, sum(cases) FROM
	OPENROWSET(
        BULK 'abs://public@pandemicdatalake.blob.core.windows.net/curated/covid-19/ecdc_cases/latest/ecdc_cases.parquet',
        FORMAT='PARQUET'
    ) AS [CovidCaseExplorer]
WHERE year = '2020'
group by countries_and_territories
order by sum(cases) desc

 

Find more sample queries in the feature documentation referenced at the end of the article.

 

Summary

Data virtualization capability, now in preview in Azure SQL Managed Instance, introduces a data abstraction concept enabling you to transparently query data stored in files in Azure Data Lake Storage and Azure Blob Storage. It enables any application capable of running T-SQL queries to consume that data by simply connecting to managed instance. It can help you optimize the TCO thanks to lower storage costs compared to storing data in a database. Finally, it improves time-to-insights by offering instant access to up-to-date data without the need to transform or relocate it.

 

Next steps

Explore the full set of data virtualization capabilities in Azure SQL Managed Instance.

1 Comment
%3CLINGO-SUB%20id%3D%22lingo-sub-3250347%22%20slang%3D%22en-US%22%3EAnnouncing%20Data%20virtualization%20with%20Azure%20SQL%20Managed%20Instance%20%E2%80%93%20preview%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3250347%22%20slang%3D%22en-US%22%3E%3CP%3EChallenges%20with%20data%20are%20common%20across%20industries%3A%20there%E2%80%99s%20more%20and%20more%20data%3B%20it%20needs%20to%20be%20analyzed%20faster%20than%20ever%3B%20and%20it%E2%80%99s%20coming%20in%20an%20increasing%20variety%20of%20formats.%20To%20respond%20to%20the%20challenges%2C%20organizations%20are%20looking%20for%20cost-efficient%20and%20reasonably%20fast%20ways%20to%20modernize%20their%20data%20platform%20and%20make%20it%20more%20flexible%20and%20future%20ready.%20%26nbsp%3BIn%20many%20cases%20the%20preferred%20approach%20is%20the%20one%20allowing%20you%20to%20achieve%20the%20goals%20while%20using%20data%20engine%20you%E2%80%99re%20familiar%20with%20and%20the%20language%2C%20frameworks%2C%20and%20tools%20of%20your%20choice.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EData%20virtualization%3C%2FSTRONG%3E%20capabilities%2C%20now%20in%20preview%20in%20Azure%20SQL%20Managed%20Instance%2C%20enable%20you%20to%20execute%20Transact-SQL%20(T-SQL)%20queries%20against%20data%20from%20files%20stored%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fstorage%2Fblobs%2Fdata-lake-storage-introduction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Data%20Lake%20Storage%20Gen2%3C%2FA%3E%26nbsp%3Bor%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fstorage%2Fblobs%2Fstorage-blobs-introduction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Blob%20Storage%3C%2FA%3E%20and%20combine%20it%20with%20relational%20data%20stored%20locally%20in%20the%20managed%20instance%20using%20logical%20joins.%20This%20way%20you%20can%20transparently%20access%20external%20data%20while%20keeping%20it%20in%20its%20original%20format%20and%20location.%20There%20is%20no%20data%20duplication%20or%20need%20to%20run%20and%20maintain%20ETL%20processes%2C%20which%20means%20that%20you%20can%20extract%20and%20deliver%20insights%20faster.%20Currently%20supported%20file%20formats%20are%20Parquet%2C%20CSV%2C%20and%20JSON.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-391790748%22%20id%3D%22toc-hId-419708695%22%3EWhen%20to%20use%20data%20virtualization%3C%2FH2%3E%0A%3CP%3ETypical%20use%20cases%20for%20data%20virtualization%20include%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EProviding%20%3CEM%3Ealways%20up-to-date%20relational%20abstraction%3C%2FEM%3E%20on%20top%20of%20your%20raw%20or%20disparate%20data%20without%20relocating%20or%20transforming%20it.%20This%20way%20any%20application%20capable%20of%20running%20T-SQL%20queries%20can%20consume%20the%20data%3A%20from%20BI%20solutions%20like%20Power%20BI%2C%20to%20line%20of%20business%20applications%2C%20to%20client%20tools%20like%20SQL%20Server%20Management%20Studio%20or%20Azure%20Data%20Studio.%20This%20is%20an%20easy%20and%20elegant%20way%20to%20expand%20the%20list%20of%20data%20sources%20for%20your%20%3CEM%3Eoperational%20reporting%3C%2FEM%3E%20solutions.%3C%2FLI%3E%0A%3CLI%3EReducing%20managed%20instance%20storage%20consumption%20and%20%3CEM%3Etotal%20cost%20of%20ownership%20(TCO)%3C%2FEM%3E%20by%20archiving%20cold%20data%20to%20Azure%20Data%20Lake%20Storage%2C%20keeping%20it%20still%20within%20the%20reach%20of%20interactive%20queries%20and%20joins.%3C%2FLI%3E%0A%3CLI%3E%3CEM%3EExploratory%20data%20analysis%3C%2FEM%3E%20of%20data%20sets%20stored%20in%20the%20most%20common%20file%20formats.%20This%20approach%20is%20typically%20used%20by%20data%20scientists%20and%20data%20analysts%20to%20collect%20insights%20about%20the%20data%20set%2C%20from%20basic%20ones%20like%20number%20and%20structure%20of%20records%2C%20to%20extracting%20important%20variables%2C%20detecting%20outliers%20and%20anomalies%2C%20and%20testing%20underlying%20assumptions.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Figure%201%20-%20Querying%20Azure%20Data%20Lake%20Storage%20files%20from%20Azure%20SQL%20Managed%20Instance%20via%20T-SQL%20queries%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F353801i75B2113C16A205CB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Data%20virtualization%203.png%22%20alt%3D%22Figure%201%20-%20Querying%20Azure%20Data%20Lake%20Storage%20files%20from%20Azure%20SQL%20Managed%20Instance%20via%20T-SQL%20queries%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFigure%201%20-%20Querying%20Azure%20Data%20Lake%20Storage%20files%20from%20Azure%20SQL%20Managed%20Instance%20via%20T-SQL%20queries%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThere%20are%20also%20scenarios%20that%20don%E2%80%99t%20fall%20into%20data%20virtualization%20category%20but%20can%20benefit%20from%20ability%20to%20query%20files%20using%20T-SQL.%20For%20example%2C%20inserting%20results%20of%20an%20external%20query%20to%20a%20local%20table%20can%20simplify%20existing%20ETL%20pipelines%20or%20even%20remove%20the%20need%20for%20dedicated%20data%20integration%20tools.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1415663715%22%20id%3D%22toc-hId--1387745768%22%3EGetting%20started%3C%2FH2%3E%0A%3CP%3EIf%20you%20are%20familiar%20with%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fsql%2Frelational-databases%2Fpolybase%2Fpolybase-guide%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EPolyBase%3C%2FA%3E%20feature%20of%20SQL%20Server%2C%20you%20may%20have%20already%20recognized%20the%20scenarios%20and%20underlying%20concepts.%20Data%20virtualization%20capabilities%20of%20Azure%20SQL%20Managed%20Instance%20use%20the%20same%20syntax%20as%20PolyBase%20and%20enrich%20it%20further%20with%20new%20options.%20PolyBase%20queries%20running%20on%20your%20SQL%20Server%20instance%20and%20targeting%20files%20stored%20in%20Azure%20Data%20Lake%20Storage%20or%20Blob%20Storage%20will%20continue%20working%20on%20your%20managed%20instance%20with%20minimal%20intervention%20to%20specify%20location%20prefix%20corresponding%20to%20the%20type%20of%20external%20source%20and%20endpoint%2C%20like%20%3CEM%3Eabs%3A%2F%2F%3C%2FEM%3E%20instead%20of%20the%20generic%20%3CEM%3Ehttps%3A%2F%2F%3C%2FEM%3E%20location%20prefix.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20enable%20data%20virtualization%20capabilities%20on%20your%20managed%20instance%2C%20run%20the%20following%20commands%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3Eexec%20sp_configure%20'polybase_enabled'%2C%201%3B%0Ago%0Areconfigure%3B%0Ago%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20simplicity%2C%20we%20are%20going%20to%20use%20publicly%20available%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fopen-datasets%2Fdataset-bing-covid-19%3Ftabs%3Dazure-storage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBing%20COVID-19%20dataset%3C%2FA%3E%20that%20allows%20anonymous%20access.%3C%2FP%3E%0A%3CP%3EFirst%2C%20create%20external%20data%20source%20encapsulating%20data%20related%20to%20the%20file%20location%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3ECREATE%20EXTERNAL%20DATA%20SOURCE%20DemoPublicExternalDataSource%0AWITH%20(%0A%20LOCATION%20%3D%20'abs%3A%2F%2Fpublic%40pandemicdatalake.blob.core.windows.net%2Fcurated%2Fcovid-19%2Fbing_covid-19_data%2Flatest'%20%0A)%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%E2%80%99re%20now%20ready%20to%20run%20the%20first%20query%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3E--Number%20of%20confirmed%20Covid-19%20cases%20per%20country%2Fterritory%20during%202020%3A%0ASELECT%20countries_and_territories%2C%20sum(cases)%20FROM%0A%20OPENROWSET(%0A%20%20%20%20%20%20%20%20BULK%20'abs%3A%2F%2Fpublic%40pandemicdatalake.blob.core.windows.net%2Fcurated%2Fcovid-19%2Fecdc_cases%2Flatest%2Fecdc_cases.parquet'%2C%0A%20%20%20%20%20%20%20%20FORMAT%3D'PARQUET'%0A%20%20%20%20)%20AS%20%5BCovidCaseExplorer%5D%0AWHERE%20year%20%3D%20'2020'%0Agroup%20by%20countries_and_territories%0Aorder%20by%20sum(cases)%20desc%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFind%20more%20sample%20queries%20in%20the%20feature%20documentation%20referenced%20at%20the%20end%20of%20the%20article.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1071849118%22%20id%3D%22toc-hId-1099767065%22%3ESummary%3C%2FH2%3E%0A%3CP%3EData%20virtualization%20capability%2C%20now%20in%20preview%20in%20Azure%20SQL%20Managed%20Instance%2C%20introduces%20a%20data%20abstraction%20concept%20enabling%20you%20to%20transparently%20query%20data%20stored%20in%20files%20in%20Azure%20Data%20Lake%20Storage%20and%20Azure%20Blob%20Storage.%20It%20enables%20any%20application%20capable%20of%20running%20T-SQL%20queries%20to%20consume%20that%20data%20by%20simply%20connecting%20to%20managed%20instance.%20It%20can%20help%20you%20optimize%20the%20TCO%20thanks%20to%20lower%20storage%20costs%20compared%20to%20storing%20data%20in%20a%20database.%20Finally%2C%20it%20improves%20time-to-insights%20by%20offering%20instant%20access%20to%20up-to-date%20data%20without%20the%20need%20to%20transform%20or%20relocate%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--735605345%22%20id%3D%22toc-hId--707687398%22%3ENext%20steps%3C%2FH2%3E%0A%3CP%3EExplore%20the%20full%20set%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fazure-sql%2Fmanaged-instance%2Fdata-virtualization-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Edata%20virtualization%20capabilities%20in%20Azure%20SQL%20Managed%20Instance.%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-3250347%22%20slang%3D%22en-US%22%3E%3CP%3EQuery%20data%20stored%20in%20files%20in%20Azure%20Data%20Lake%20Storage%20from%20your%20Azure%20SQL%20Managed%20Instance%20using%20Transact%20SQL%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3250347%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20SQL%20Managed%20Instance%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3259892%22%20slang%3D%22en-US%22%3ERe%3A%20Announcing%20Data%20virtualization%20with%20Azure%20SQL%20Managed%20Instance%20%E2%80%93%20preview%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3259892%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20posting%20this%20article%2C%20a%20great%20feature.%20My%20customer%20is%20almost%20near%20to%20the%20capacity%20limits%20of%20MI%2C%20and%20this%20feature%20help%20me%20to%20move%20some%20older%20data%20to%20the%20ADLS.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Mar 17 2022 04:01 PM
Updated by: