Introducing data virtualization with PolyBase
Applies to: SQL Server Azure SQL Database Azure Synapse Analytics Analytics Platform System (PDW)
PolyBase is a data virtualization feature for SQL Server.
What is PolyBase?
PolyBase enables your SQL Server instance to query data with T-SQL directly from SQL Server, Oracle, Teradata, MongoDB, Hadoop clusters, Cosmos DB, and S3-compatible object storage without separately installing client connection software. You can also use the generic ODBC connector to connect to additional providers using third-party ODBC drivers. PolyBase allows T-SQL queries to join the data from external sources to relational tables in an instance of SQL Server.
A key use case for data virtualization with the PolyBase feature is to allow the data to stay in its original location and format. You can virtualize the external data through the SQL Server instance, so that it can be queried in place like any other table in SQL Server. This process minimizes the need for ETL processes for data movement. This data virtualization scenario is possible with the use of PolyBase connectors.
Supported SQL products and services
PolyBase provides these same functionalities for the following SQL products from Microsoft:
- SQL Server 2016 (13.x) and later versions (Windows)
- SQL Server 2019 (15.x) and later versions (Windows and Linux)
- SQL Server Analytics Platform System (PDW) (PDW), hosted in the Analytics Platform System (APS)
- Azure Synapse Analytics
Data virtualization using PolyBase feature is available in preview for Azure SQL Managed Instance, scoped to querying external data stored in files in Azure Data Lake Storage (ADLS) Gen2 and Azure Blob Storage. Visit Data virtualization with Azure SQL Managed Instance to learn more.
SQL Server 2022 PolyBase enhancements
|New to SQL Server 2022 (16.x) Preview||Details|
|S3-compatible object storage||SQL Server 2022 (16.x) Preview adds new connector, S3-compatible object storage, using the S3 REST API. You can use both
|Some connectors separate from PolyBase services||The S3-compatible object storage connector, as well as ADSL Gen2, and Azure Blob Storage, are no longer dependent of PolyBase services. PolyBase services must still run to support connectivity with Oracle, Teradata, MongoDB, and Generic ODBC. The PolyBase feature must still be installed on your SQL Server instance.|
|Parquet file format||PolyBase is now capable of querying data from Parquet files stored on S3-compatible object storage. For more information, see to Virtualize parquet file in a S3-compatible object storage with PolyBase.|
|Delta table format||PolyBase is now capable of querying (read-only) data from Delta Table format stored on S3-compatible object storage, Azure Storage Account V2, and Azure Data Lake Storage Gen2. For more information, see to Virtualize Delta Table format|
|Create External Table as Select (CETAS)||PolyBase can now use CETAS to create an external table and then export, in parallel, the result of a Transact-SQL SELECT statement to Azure Data Lake Storage Gen2, Azure Storage Account V2, and S3-compatible object storage. For more information, see CREATE EXTERNAL TABLE AS SELECT (Transact-SQL).|
For more new features of SQL Server 2022 (16.x) Preview, see What's new in SQL Server 2022?
For an example using PolyBase in SQL Server 2022 (16.x) Preview to virtualize a CSV file in Azure Storage, see Virtualize CSV file with PolyBase.
The PolyBase feature provides connectivity to the following external data sources:
|External data sources||SQL Server 2016-2019 with PolyBase||SQL Server 2022 (16.x) Preview with PolyBase||APS PDW||Azure Synapse Analytics|
|Oracle, MongoDB, Teradata||Read||Read||No||No|
|Generic ODBC||Read (Windows Only)||Read (Windows Only)||No||No|
|S3-compatible object storage||No||Read/Write||No||No|
- SQL Server 2022 (16.x) Preview does not support Hadoop.
- SQL Server 2016 (13.x) introduced PolyBase with support for connections to Hadoop and Azure blob storage.
- SQL Server 2019 (15.x) introduced additional connectors, including SQL Server, Oracle, Teradata, and MongoDB.
- SQL Server 2022 (16.x) Preview introduced the S3-Compliant Storage connector.
Examples of external connectors include:
* PolyBase supports two Hadoop providers, Hortonworks Data Platform (HDP) and Cloudera Distributed Hadoop (CDH), through SQL Server 2019. SQL Server support for HDFS Cloudera (CDP) and Hortonworks (HDP) external data sources will be retired and will not be included in SQL Server 2022 (16.x) Preview. For more information, see Big data options on the Microsoft SQL Server platform.
To use PolyBase in an instance of SQL Server:
- Install PolyBase on Windows or Install PolyBase on Linux.
- Starting with SQL Server 2019 (15.x), enable PolyBase in sp_configure, if necessary.
- Create an external data source.
- Create an external table.
With the underlying help of PolyBase, T-SQL queries can also import and export data from Azure blob storage. Further, PolyBase enables Azure Synapse Analytics to import and export data from Azure Data Lake Store, and from Azure blob storage.
Why use PolyBase?
PolyBase allows you to join data from a SQL Server instance with external data. Prior to PolyBase to join data to external data sources you could either:
- Transfer half your data so that all the data was in one location.
- Query both sources of data, then write custom query logic to join and integrate the data at the client level.
PolyBase allows you to simply use Transact-SQL to join the data.
PolyBase does not require you to install additional software to your Hadoop environment. You query external data by using the same T-SQL syntax used to query a database table. The support actions implemented by PolyBase all happen transparently. The query author does not need any knowledge about the external source.
PolyBase enables the following scenarios in SQL Server:
Query data stored in Hadoop from a SQL Server instance or PDW. Users are storing data in cost-effective distributed and scalable systems, such as Hadoop. PolyBase makes it easy to query the data by using T-SQL.
Query data stored in Azure blob storage. Azure blob storage is a convenient place to store data for use by Azure services. PolyBase makes it easy to access the data by using T-SQL.
Import data from Hadoop, Azure blob storage, or Azure Data Lake Store. Leverage the speed of Microsoft SQL's columnstore technology and analysis capabilities by importing data from Hadoop, Azure blob storage, or Azure Data Lake Store into relational tables. There is no need for a separate ETL or import tool.
Export data to Hadoop, Azure blob storage, or Azure Data Lake Store. Archive data to Hadoop, Azure blob storage, or Azure Data Lake Store to achieve cost-effective storage and keep it online for easy access.
Integrate with BI tools. Use PolyBase with Microsoft's business intelligence and analysis stack, or use any third-party tools that are compatible with SQL Server.
Push computation to Hadoop. (Applies to SQL Server 2016 (13.x), SQL Server 2017 (14.x), and SQL Server 2019 (15.x) only.) PolyBase pushes some computations to the external source to optimize the overall query. The query optimizer makes a cost-based decision to push computation to Hadoop, if that will improve query performance. The query optimizer uses statistics on external tables to make the cost-based decision. Pushing computation creates MapReduce jobs and leverages Hadoop's distributed computational resources. For more information, see Pushdown computations in PolyBase.
Scale compute resources. (Applies to SQL Server 2016 (13.x), SQL Server 2017 (14.x), and SQL Server 2019 (15.x) only.) To improve query performance, you can use SQL Server PolyBase scale-out groups. This enables parallel data transfer between SQL Server instances and Hadoop nodes, and it adds compute resources for operating on the external data.
The Microsoft SQL Server PolyBase scale-out groups will be retired. Scale-out group functionality will be removed from the product in SQL Server 2022 (16.x) Preview. PolyBase data virtualization will continue to be fully supported as a scale-up feature in SQL Server. For more information, see Big data options on the Microsoft SQL Server platform.
Upgrading to SQL Server 2022
Starting in SQL Server 2022 (16.x) Preview Hadoop is no longer supported. It is required to manually recreate external data sources previously created with TYPE = HADOOP, and any external table that uses this external data source.
Users will also need to configure their external data sources to use new connectors when connecting to Azure Storage.
|External Data Source||From||To|
|Azure Blob Storage||wasb[s]||abs|
|ADLS Gen 2||abfs[s]||adls|
Before using PolyBase, you must install PolyBase on Windows or install PolyBase on Linux, and enable PolyBase in sp_configure if necessary. For more tutorials on creating external data sources and external tables to a variety of data sources, see PolyBase Transact-SQL reference.
Review PolyBase Transact-SQL reference with examples of external data sources and external tables for a variety of data sources. For more tutorials, review the following articles:
Submit and view feedback for