Polybase in Azure Data Factory

What is Polybase in Azure Data Factory?

What Is Polybase in Azure Data Factory

Polybase is a feature in Azure Data Factory that allows for the seamless and fast integration of structured and unstructured data from various sources. It enables users to easily access and analyze data from disparate systems such as Hadoop, Teradata, and SQL Server without the need for complex ETL processes. 

Polybase is a tool that allows users to access data from a variety of sources with a single query. It can access structured and unstructured data, including data stored in Hadoop Distributed File System (HDFS) and Azure Blob Storage. Polybase has the capability to integrate data from a variety of sources and platforms, including Microsoft SQL Server, Oracle, Teradata, and others. It provides a single platform for accessing data and querying it in a variety of ways, making it an ideal tool for business intelligence (BI) and data analytics.

Polybase offers a unified interface for accessing data from various sources. This eliminates the need for users to learn multiple query languages or data access methods. Instead, they can utilize SQL Server T-SQL language to retrieve and query data from various sources, resulting in a simpler data working experience and decreased time and energy required for data analysis.

Polybase uses external tables to access data from external sources. An external table is a special type of table that is defined in the database but references data stored outside the database. The external table defines the structure of the data and its location, and the query engine uses this information to retrieve the data when the table is queried. Polybase supports different file formats, such as text, CSV, Parquet, ORC, and others.

Polybase in Azure Data Factory also supports query pushdown, where it pushes processing tasks down to the source system rather than executing all tasks within Polybase. This helps to improve query performance by reducing data movement across the network. Furthermore, Polybase in Azure Data Factory includes support for dynamic data masking, which restricts access to sensitive data within a query.

Polybase supports different types of data movement, such as parallel data movement and bulk data movement. Parallel data movement is used when small amounts of data need to be moved between data sources. Bulk data movement is used when large amounts of data need to be moved. Bulk data movement is faster than parallel data movement, as it uses multiple parallel streams to move data.

Polybase can be used with Azure Data Factory to create pipelines that can extract data from multiple sources, transform the data, and load it into a destination data store. Azure Data Factory provides a visual interface for creating data pipelines, which makes it easy for users to design and deploy pipelines that use Polybase to access data from multiple sources.

ETL process using PolyBase

The ETL (Extract, Transform, Load) process using Polybase in Azure Data Factory is a simple and effective way to integrate data from various sources. Polybase reduces complexity by allowing users to query external data sources and join data from multiple sources with ease. The following are the steps involved in the ETL process using Polybase in Azure Data Factory:

  • Extract: In the first step of the ETL process, data is extracted from various sources such as Hadoop, Teradata, and SQL Server using Polybase. The Polybase service queries the external data sources, extracts data and returns it to Azure Data Factory for processing.
  • Transform: During the transform stage, data is prepared and processed for analysis, which involves tasks like data cleaning, mapping, and conversion. Polybase enables users to perform these tasks directly on extracted data or in combination with other sources. With this feature, users can easily apply transformations to their data.
  • Load: In the final step of the ETL process, the transformed data is loaded into the target destination, such as Azure Data Warehouse or SQL Server. Polybase supports parallel loading of data, which enables the loading of very large data sets into the target system for analysis.

The following are some of the best practices to follow when using Polybase in the ETL process in Azure Data Factory:

  • Use column store indexes: When loading data into SQL Server using Polybase, it is recommended to use column store indexes to improve query performance.
  • Use external file formats: Polybase supports multiple file formats such as CSV, TSV, and ORC. The use of an external file format allows for more efficient parsing and processing of data during extraction.
  • Use stored procedures: Stored procedures can be used to handle complex transformations on the data extracted using Polybase. These procedures can be used to insert, update or delete records in the target system.
  • Use compression: When loading large data sets into Azure Data Warehouse using Polybase, it is advisable to use compression to reduce storage costs and improve query performance.
  • Use query pushdown: Query pushdown allows for more efficient execution of queries. It pushes processing tasks down to the source system rather than executing all tasks within Polybase, which helps reduce data movement across the network.

Advantages of Using Polybase

  • Simplified data integration: Polybase allows users to easily access and query data from disparate systems without the need for complex ETL processes. Real-Time Data Integration: Polybase supports real-time data integration, allowing users to access and combine data from different sources in real-time. 
  • Support for multiple input formats: Polybase supports multiple input formats, including delimited text files, Hive tables, HBase tables, and ORC files. This enables users to work with different data formats and extract data from numerous external data sources.
  • Query external data sources: Polybase allows users to query external data sources such as Hadoop and other data stores. This enables users to easily access and analyze data from a wide range of sources, providing a more comprehensive view of their data.
  • Distributed queries: Polybase enables users to perform distributed queries across both structured and unstructured data sources. This means that users can query data in Azure Data Lake Store or Hadoop Distributed File System (HDFS) alongside data stored in traditional SQL Server databases, all within a single query.
  • Supports query pushdown: Polybase supports query pushdown, where it pushes processing tasks down to the source system rather than executing all tasks within Polybase. 
  • Dynamic data masking: Polybase includes support for dynamic data masking, which restricts access to sensitive data within a query. This helps to ensure data security and compliance with regulatory requirements.

Disadvantages or Limitations of Polybase

  • Polybase can be complex: As with any complex technology, there is a learning curve associated with using Polybase. Users may require additional training and resources to fully understand and leverage its functionality.
  • Only supports certain data sources: While Polybase supports querying external data sources such as Hadoop, Teradata, and SQL Server, it does not support all data sources. This can be limiting for businesses that rely on data sources not supported by Polybase.
  • Limited support for certain data formats: While Polybase supports multiple data formats, it does not support all formats. Users may need to convert data formats before loading data into Polybase.
  • Performance: While Polybase can handle large volumes of data, performance can be impacted by factors such as network latency, data skew, and resource contention. 
  • Lack of Complex Data Transformations: Polybase is primarily designed for simple data transformations using T-SQL commands. It does not support complex data transformations, such as machine learning models or custom data transformations.
  • Limited Functionality: Polybase has limited functionality compared to other data integration technologies such as Azure Data Factory. It does not support complex data transformations, metadata management, or workflow orchestration.
  • Limited Support for Cloud Data Sources: Polybase has limited support for cloud data sources such as Amazon S3 and Google Cloud Storage, limiting its ability to work with data sources outside of the Azure ecosystem.

Polybase External Tables

Polybase External Tables are a key feature of Polybase in Azure Data Factory that allow users to access and integrate data from different data sources such as Azure Blob Storage, Hadoop, and SQL Server, without needing to physically move the data.

Polybase External Tables work by defining metadata that maps external tables to data sources. The defined metadata allows users to access external data sources using traditional SQL queries to retrieve and manipulate data. The data can be queried, joined, and processed in conjunction with traditional database tables.

The External Tables feature in Polybase offers several advantages, including:

  • Create External Tables: Users can create external tables in SQL Server that reference data stored in external data sources. External tables define the schema of the data and the location of the data source.
  • Define Data Source: Users can define a data source for an external table that specifies the location of the data source, the file format of the data, and any access credentials required to access the data source.
  • Data Types: External tables support a wide range of data types, including string, integer, decimal, and date/time data types.
  • Querying Data: Once an external table is created, users can query the data using standard SQL queries. Users can perform filtering, aggregation, and join operations on the data.
  • Performance: External tables leverage Polybase’s parallel processing capabilities to optimize query performance. Parallel processing enables queries to be executed across multiple nodes in the cluster, reducing query time and improving performance.
  • Scalable Analysis: Polybase External Tables enable users to scale their analysis capabilities by using Azure SQL Data Warehouse or other distributed computing systems that can analyze and process large volumes of data quickly.
  • Cost-effectiveness: External Tables in Polybase does not require any additional licensing costs, which is a significant advantage for IT departments operating on a tight budget
  • Data Movement: External tables allow users to access and manipulate data in external data sources without physically moving the data. This can save time and resources by eliminating the need to move data between data sources.
  • Security: External tables support security features such as encryption, authentication, and authorization to ensure that data is protected.

Why is polybase so fast ?

  • Polybase uses a distributed query engine that can scale across multiple nodes, which allows queries to be processed faster and more efficiently.
  • Polybase allows for data movement and processing to be pushed down to the source system.This means that processing tasks are executed by the external data source itself, reducing network traffic and processing overhead.
  • Polybase uses a massively parallel processing architecture to distribute queries across multiple nodes in the cluster, which allows it to handle large volumes of data quickly and efficiently.
  • Polybase leverages columnstore indexes to optimize query performance, improving the speed and efficiency of analytical workload queries.
  • Polybase uses SQL Server Integration Services (SSIS) to facilitate large scale data movement between source and target systems in a way that is optimized for high throughput and speed.
  • Polybase uses advanced data compression techniques to minimize data movement between nodes in the cluster, which reduces the amount of data that needs to be transferred and processed.
  • Polybase supports fast data loading using the bulk insert feature, which allows it to load large volumes of data quickly and efficiently.

Polybase supports partitioning, which enables parallel query processing across multiple data partitions, improving query performance and reducing the time required to return results.

How to enable polybase?

  • Open SQL Server Management Studio.
  • Connect to the SQL Server instance you want to enable Polybase on.
  • Right-click on the server name and select “Properties”.
  • In the “Server Properties” dialog box, select the “Advanced” tab.
  • Scroll down to the “Polybase Enabled” option and check the box to enable Polybase.
  • Click “OK” to apply the changes.
  • Restart the SQL Server instance to activate Polybase.

Once Polybase is enabled, you can create External Data Sources and External Tables to access data stored externally in Hadoop-based data stores, such as Azure Data Lake Store or Hadoop Distributed File System (HDFS), as if it were stored in traditional database tables.

Note: If you are using Azure SQL Data Warehouse, Polybase is enabled by default and you can start creating External Data Sources and External tables immediately.

Polybase enabled Instance

A Polybase enabled instance refers to a SQL Server or Azure SQL Data Warehouse instance that has the Polybase feature enabled. Polybase is a powerful feature that allows users to seamlessly integrate and analyze structured and unstructured data from various external sources.

The Polybase feature can be enabled in SQL Server Management Studio for SQL Server instances or is enabled by default for Azure SQL Data Warehouse instances.

A Polybase enabled instance provides users with the ability to create external data sources and external tables to access and query data from external sources, such as Hadoop-based data stores. Polybase also supports parallel loading of data and dynamic data masking for improved efficiency, security, and compliance.

Additionally, Polybase integrates with Azure services such as Azure Data Lake Store, Azure Blob Storage, and Azure HDInsight to provide a more comprehensive view of data and analysis capabilities.

To activate PolyBase on an Azure SQL Data Warehouse instance, follow these steps:

  • Connect to your Azure SQL Data Warehouse master database with SSMS.
  • To initiate a “scriptable install”, simply right-click on the master database and select the option from the context menu.
  • Upon opening the dialog box, a list of installable components will be displayed.
  • Please choose all options.
  • Please proceed by clicking the “next” button.
  • The script is set to execute in SSMS.

Conclusion

Polybase is a powerful and innovative feature in Azure Data Factory that provides a streamlined and efficient way to integrate and analyze big data from various external sources. The feature simplifies the ETL process by reducing complexity involved in moving data from multiple sources and enables users to query structured and unstructured data sources with ease.

Polybase offers several benefits, including simplified data integration, support for multiple input formats, distributed queries, query pushdown, support for dynamic data masking, and seamless integration with Azure services such as Azure SQL Data Warehouse and Power BI.

While there are some limitations to Polybase, such as limited support for real-time data integration and the requirement for significant computation resources, its advantages and benefits make it a popular and powerful tool for businesses looking to unlock the full potential of their data.

Overall, Polybase represents an essential feature of Azure Data Factory that provides users with a powerful way to integrate and analyze data stored externally in Hadoop-based data stores or other sources with relative ease.

Polybase in Azure Data Factory FAQs;
What is Polybase in Azure Data Factory?

Polybase is a technology in Azure Data Factory that enables users to access and integrate data from various data sources quickly and efficiently.

Which data sources does Polybase support in Azure Data Factory?

Polybase supports a range of data sources including Hadoop, Azure Blob Storage, and SQL Server.

How does Polybase achieve its speed and efficiency in Azure Data Factory?

Polybase leverages a distributed query engine, massively parallel processing architecture, columnar storage format, advanced data compression techniques, SQL Server’s query optimization and indexing features, fast data loading using bulk insert, and partitioning of data to achieve its speed and efficiency.

How do I enable Polybase in Azure Data Factory?

To enable Polybase in Azure Data Factory, you need to create an Azure SQL Server instance, enable Polybase, create a master key, create a database scoped credential, create an external data source, create an external file format, and create an external table.

Can I use Polybase to query data from non-Microsoft data sources in Azure Data Factory?

 While Polybase supports a range of data sources, including Hadoop and Azure Blob Storage, it has limited support for non-Microsoft data sources.

Is Polybase suitable for all types of data integration and processing scenarios in Azure Data Factory?

While Polybase is a powerful technology for data integration and processing, it may not be suitable for all types of data integration and processing scenarios. It is important to evaluate your specific use case and requirements before deciding to use Polybase.

Register for the Azure Live Demo Class for FREE

*You can watch a demo video recording after filling this form

*By filling the form you are giving us the consent to receive emails from us regarding all the updates.