{"id":3789,"date":"2021-11-25T13:40:23","date_gmt":"2021-11-25T21:40:23","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3789"},"modified":"2021-11-25T13:40:24","modified_gmt":"2021-11-25T21:40:24","slug":"how-to-import-data-from-odata-to-azure-data-factory","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3789","title":{"rendered":"How to Import Data from OData to Azure Data Factory"},"content":{"rendered":"\n<p>by&nbsp;Gauri Mahajan<\/p>\n\n\n\n<p>In this article, we will learn how to use Azure Data Factory to import data from OData APIs on Azure storage repositories.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>Data practice has the following major part \u2013 Data Collection, Data Preparation and Curation, Data Management, and Data Consumption. Typically, data consumption is viewed as a practice of accessing data from data repositories by connecting to it using database drivers. NoSQL databases employ APIs to facilitate read-write operations on the data repositories. Another popular and modern approach to consume data is by using Application Programming Interfaces a.k.a. APIs. One of the most well-known forms of APIs is REST APIs, which is one of the architecture standards for APIs. OData is extended sets of guidelines on the top of REST APIs that are often used to define the data model in the APIs for facilitating data ingestion as well as consumption using these data APIs. OData has been a popular standard for interfacing with data and with the cloud becoming the preferred platform for hosting data, there comes a need to consume import data from data repositories that enable data access using their published OData APIs. On the Azure cloud platform, various data repositories can host a variety of data. Using Azure Data Factory, we can import data from OData APIs and populate different types of data repositories and facilitate data exchange using the OData APIs. Let\u2019s move forward and learn how to use Azure Data Factory in importing data from OData APIs on Azure storage repositories.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is OData?<\/h2>\n\n\n\n<p>Before we proceed with the actual implementation of importing data from the OData feeds, let\u2019s understand few important basics of OData in a little more detail for conceptual clarity.&nbsp;<strong>Re<\/strong>presentational&nbsp;<strong>S<\/strong>tate&nbsp;<strong>T<\/strong>ransfer (REST) is a resource-based architectural style or pattern. OData is an application-level protocol. Microsoft introduced OData in 2007 and over the years it became an industry-standard protocol. While REST is a generic set of guidelines to build REST APIs, OData can be considered a technology that can be used to enable data access using interoperable REST APIs. Data exposed via OData APIs typically have AtomPub or JSON as the output format. If an OData connector is used to access data from OData APIs, the connector generally takes care of converting these data formats into a standard tabular format which can be readily loaded into the destination data repository.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Importing OData Feed<\/h2>\n\n\n\n<p>Now that we understand OData at a high level, we are ready to proceed with the actual implementation. We intend to use the OData API as the source and one of the supported Azure data repositories as the destination. We would be using Azure Data Factory as the ETL or importing tool that would fetch data from source to destination. For this, firstly we need an OData API that publishes some data which we can consume. One of the most popular and freely available OData API is the Northwind OData APIs which exposes several tables with sample data and is based on the popular Northwind sample database distributed by Microsoft in the early versions of SQL Server. This service can be accessed from this&nbsp;<a href=\"https:\/\/services.odata.org\/V2\/Northwind\/Northwind.svc\/\" target=\"_blank\" rel=\"noreferrer noopener\">URL<\/a>. If one can reach this API via a standard internet connection, an Azure Storage account with a container in it already exists, and an Azure Data Factory instance is already created, we are ready to start the actual implementation.<\/p>\n\n\n\n<p>Navigate to the Azure Data Factory instance and open the dashboard page. Click the&nbsp;<strong>Author and monitor<\/strong>&nbsp;link to open the Azure Data Factory portal, and you should be able to see the home page as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/azure-data-factory-portal.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/azure-data-factory-portal.png\" alt=\"Azure Data Factory Portal\"\/><\/a><\/figure>\n\n\n\n<p>We intend to import data from the OData APIs, so we can directly use the copy tool. Click on the&nbsp;<strong>Copy<\/strong>&nbsp;data icon and it would initiate the copy wizard as shown below. Provide an appropriate name for this task. For now, we intend to execute this task only once, so we can continue with the default option of Run Once now as the execution frequency.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/azure-data-factory-copy-wizard.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/azure-data-factory-copy-wizard.png\" alt=\"Azure Data Factory - Copy Wizard\"\/><\/a><\/figure>\n\n\n\n<p>In the next step, we need to select the source data repository. Search for OData and you would find it as shown below. We need to create a new linked service of OData type. Click on the OData icon and then click on the&nbsp;<strong>Continue<\/strong>&nbsp;button to move to the next step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/odata-linked-service.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/odata-linked-service.png\" alt=\"OData Linked Service\"\/><\/a><\/figure>\n\n\n\n<p>In this step, we need to configure the details to connect to the OData API. Provide an appropriate name for this connection. We can use the existing Auto Resolve Integration Runtime which is selected by default. Key in the service URL of the OData API in the Service URL field. This connection supports multiple types of authentication mechanisms, but in our case, it\u2019s a publicly accessible API, so we would use the Anonymous style of authentication as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/odata-connection.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/odata-connection.png\" alt=\"OData connection\"\/><\/a><\/figure>\n\n\n\n<p>Once the configuration is done, click on the&nbsp;<strong>Test Connection<\/strong>&nbsp;button, and if everything is configured correctly, the connection should be successful as shown below. Click on the&nbsp;<strong>Create<\/strong>&nbsp;button and proceed to the next step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/successful-connectivity.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/successful-connectivity.png\" alt=\"Successful Connectivity\"\/><\/a><\/figure>\n\n\n\n<p>In this step, we need to configure the datasets that we intend to import. Based on the definition of the API, we would be presented with a list of tables to select from. One of the tables in the list is the Customers table, select the same and you would be able to preview the data as well as shown below. Proceed to the Next step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/select-datasets.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/select-datasets.png\" alt=\"Select Datasets\"\/><\/a><\/figure>\n\n\n\n<p>In this step, one can validate whether the data types and other details of the table are compatible for Azure Data Factory to import this type of data. Click on the&nbsp;<strong>Validate<\/strong>&nbsp;button to validate the table for import. Once the validation is successful, proceed to the&nbsp;<strong>Next<\/strong>&nbsp;step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/validate-data.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/validate-data.png\" alt=\"Validate Data\"\/><\/a><\/figure>\n\n\n\n<p>Now we need to select the destination linked service. Follow the same step mentioned above for OData API, and instead, this time select the Azure Storage Account which we would be using as the destination. Once the linked service is registered, it would look as shown below. Select the same and proceed to the next step to configure the location where we would import the data. One can also select any other data repository as the destination.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/destination-linked-service.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/destination-linked-service.png\" alt=\"Destination Linked Service\"\/><\/a><\/figure>\n\n\n\n<p>In this step, we need to configure an existing folder in the Azure Data Lake Storage account where we would be storing the imported data. Provide a relevant location and a file name and proceed to the next step.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/output-directory.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/output-directory.png\" alt=\"Output directory\"\/><\/a><\/figure>\n\n\n\n<p>In this step, we need to configure the file format and other file-related settings. Let\u2019s say that we intend to store this data in the form of a CSV file. So, select the settings as shown below. One other important setting is to add column headers in the file. As we are importing data from an external API into a file, it\u2019s important to add headers else it would be confusing to identify the columns. So, ensure to check this option as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/file-format-settings.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/file-format-settings.png\" alt=\"File format settings\"\/><\/a><\/figure>\n\n\n\n<p>In this step, we can optionally configure the data consistency and performance-related setting. For now, in this exercise, we can continue with the default settings. While moving this to production, these settings are very important to configure.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/data-consistency-and-performance-settings.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/data-consistency-and-performance-settings.png\" alt=\"Data consistency and performance settings\"\/><\/a><\/figure>\n\n\n\n<p>Validate the configured settings before execution as shown below. Once verified, proceed to the next step where it would start the execution.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/summary.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/summary.png\" alt=\"Summary\"\/><\/a><\/figure>\n\n\n\n<p>Once the execution is complete, navigate to the location where we configured the file to be created and open the file. We should be able to find that the data was imported successfully in a CSV format with column headers in it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/output-file.png\"><img decoding=\"async\" src=\"https:\/\/www.sqlshack.com\/wp-content\/uploads\/2021\/09\/output-file.png\" alt=\"Output File\"\/><\/a><\/figure>\n\n\n\n<p>In this way, we can import data from OData APIs using Azure Data Factory.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>In this article, we understood what OData is and how it plays a role in the data consumption and data publishing process. We learned how to use Azure Data Factory with OData to import the data in Azure support data repositories.<\/p>\n\n\n\n<p>Ref: https:\/\/azure.microsoft.com\/en-ca\/blog\/introduction-to-open-data-protocol-odata-and-sql-azure\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>by&nbsp;Gauri Mahajan In this article, we will learn how to use Azure Data Factory to import data from OData APIs on Azure storage repositories. Introduction Data practice has the following major part \u2013 Data Collection, Data Preparation and Curation, Data Management, and Data Consumption. Typically, data consumption is viewed as a practice of accessing data <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3789\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[238,239],"tags":[955,956],"class_list":["post-3789","post","type-post","status-publish","format-standard","hentry","category-cloud","category-azure","tag-azure-data-factory","tag-import-data-from-odata-to-azure-data-factory"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3789"}],"version-history":[{"count":2,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3789\/revisions"}],"predecessor-version":[{"id":3791,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3789\/revisions\/3791"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}