<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rasika Eshwar on Medium]]></title>
        <description><![CDATA[Stories by Rasika Eshwar on Medium]]></description>
        <link>https://medium.com/@rasika.eshwar?source=rss-86c735963886------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4ezDWlxKYeC1AzGi3lsr9w.png</url>
            <title>Stories by Rasika Eshwar on Medium</title>
            <link>https://medium.com/@rasika.eshwar?source=rss-86c735963886------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:16:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rasika.eshwar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Simplifying Lineage Mapping in Microsoft Purview: A Python Approach]]></title>
            <link>https://medium.com/bi3-technologies/simplifying-lineage-mapping-in-microsoft-purview-a-python-approach-1d3bc023b881?source=rss-86c735963886------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d3bc023b881</guid>
            <category><![CDATA[lineage]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[microsoft-purview]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rasika Eshwar]]></dc:creator>
            <pubDate>Thu, 30 May 2024 07:33:09 GMT</pubDate>
            <atom:updated>2024-05-30T07:33:09.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5LR13MqcmcY-8JPQ9ebDMQ.gif" /><figcaption>Simplifying Lineage Mapping in Microsoft Purview: A Python Approach</figcaption></figure><h3>Introduction</h3><p>In today’s data-driven world, understanding data flow is essential for data integrity, compliance, and decision-making. Microsoft Purview provides robust data governance and lineage tracking. This guide explores creating lineage between dimension and fact tables in Purview by extracting Excel lineage details using Python.</p><h3>Why Lineage Matters</h3><p>Before delving into the technical aspects, let’s understand the importance of lineage. Lineage offers a clear view of the data’s journey from its origin to its endpoint. It assists in:</p><ol><li><strong>Data Quality Assurance:</strong> By tracing the data lineage, organizations can ensure data accuracy and identify any discrepancies or anomalies in the data flow.</li><li><strong>Regulatory Compliance:</strong> Regulations governing data handling and reporting are strict in many businesses. By offering a clear picture of data transit and transformations, lineage aids in proving compliance.</li><li><strong>Impact Analysis: </strong>Lineage enables organizations to evaluate the potential effects on downstream systems and reports when modifications are made to data sources or transformations.</li></ol><h3>Extracting Lineage Details from Excel</h3><p>Microsoft Purview supports various data sources for lineage tracking, including Excel files. Using Python, we can extract lineage details from Excel files and push them to Microsoft Purview. Here’s a step-by-step guide:</p><p>Install Required Libraries: Begin by installing the necessary Python libraries such as pandas, JSON, and requests, which will facilitate data extraction and interaction with Microsoft Purview API.</p><p>In this context, two distinct APIs have been utilized: one for generating entities and the other for establishing relationships between existing entities.</p><p>Lineage creation can be accomplished by following these steps.</p><p><strong>Step -1: Read Excel File</strong></p><blockquote>Utilize the pandas library to read the Excel file and extract metadata to construct data for transmitting to the API.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*etrTr59asYr7a6AmERn2Vg.png" /><figcaption>Entity Sheet Example data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*6KZsGtZh9bAv7cuAnIFFgw.png" /><figcaption>Dependency Sheet Example data</figcaption></figure><p><strong>Step -2: Define Entities and Relationships</strong></p><blockquote>In the “Entity” sheet, align table names with their respective column names. Meanwhile, in the “Dependency” sheet, describe the relationships between tables by indicating the source and destination table names along with the columns from each table utilized for joining.</blockquote><p><strong>Step -3: Push Lineage to Purview</strong></p><blockquote>Utilize the Purview API, along with authentication tokens, to push the extracted lineage details to Microsoft Purview.</blockquote><pre>import requests<br>import json<br>import pandas as pd<br><br>AZ_TENANT_ID=&quot;xxx&quot;<br>AZ_CLIENT_ID=&quot;yyy&quot;<br>AZ_CLIENT_SECRET=&quot;zzz&quot;<br>EXCEL_PATH=&quot;C://Users/abcd/lineage.xlsx&quot;<br><br>def get_access_token() -&gt; str:<br>    # Authentication: Obtain an Azure AD token<br>    token_url = f&quot;https://login.microsoftonline.com/xxxxxxxxxxxxxxx/oauth2/token&quot;<br>    token_payload = {<br>        &quot;grant_type&quot;: &quot;client_credentials&quot;,<br>        &quot;client_id&quot;: AZ_CLIENT_ID,<br>        &quot;client_secret&quot;: AZ_CLIENT_SECRET,<br>        &quot;resource&quot;: &quot;https://purview.azure.net&quot;,<br>    }<br>    token_response = requests.post(token_url, data=token_payload)<br>    access_token = token_response.json()[&quot;access_token&quot;]<br>    return access_token<br><br>def calculate_col_count(df):<br>    table_column_counts = df.groupby(&quot;TableName&quot;)[&quot;ColumnName&quot;].nunique()<br>    result = {}<br>    for table, column_count in table_column_counts.items():<br>        result[table] = column_count<br>    return result<br><br>def generate_guid():<br>    df = pd.read_excel(EXCEL_PATH, sheet_name=&quot;Entity&quot;)<br>    grouped = df.groupby(&quot;TableName&quot;)<br>    resulttableguid = {}<br>    idx = 0<br>    for group_name, group_df  in grouped:<br>        idx += 1<br>        resulttableguid[group_name] = &quot;-&quot; + str(idx)<br>    return resulttableguid<br><br>def create_entity():<br>    API_ENDPOINT_1 = (<br>        &quot;https://PURVIEW_NAME.purview.azure.com/datamap/api/atlas/v2/entity/bulk&quot;<br>    )<br>    access_token = get_access_token()<br>    headers = {<br>        &quot;Authorization&quot;: f&quot;Bearer {access_token}&quot;,<br>        &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    }<br>    df1 = pd.read_excel(EXCEL_PATH, sheet_name=&quot;Entity&quot;)<br>    calculate_col_count(df1)<br>    resulttableguid=generate_guid()<br>    iterationcount = 0<br>    grouped = df1.groupby(&quot;TableName&quot;)<br>    data = {&quot;entities&quot;: []}<br>    # Iterate over each group (each distinct table name)<br>    for table_name, group_df in grouped:<br>        table_data = {<br>            &quot;typeName&quot;: &quot;hive_table&quot;,<br>            &quot;attributes&quot;: {<br>                &quot;qualifiedName&quot;: f&quot;test_lineage.{table_name}&quot;,<br>                &quot;name&quot;: f&quot;{table_name}&quot;,<br>            },<br>            &quot;relationshipAttributes&quot;: {&quot;columns&quot;: []},<br>            &quot;guid&quot;: f&quot;{resulttableguid[table_name]}&quot;,<br>        }<br>        for idx, (index, row) in enumerate(group_df.iterrows()):<br>            column_data = {<br>                &quot;guid&quot;: f&quot;{resulttableguid[table_name]}{idx}&quot;,<br>                &quot;typeName&quot;: &quot;hive_column&quot;,<br>            }<br>            column_full_data = {<br>                &quot;typeName&quot;: &quot;hive_column&quot;,<br>                &quot;attributes&quot;: {<br>                    &quot;qualifiedName&quot;: f&quot;test_lineage.{table_name}#{row[&#39;ColumnName&#39;]}&quot;,<br>                    &quot;name&quot;: f&quot;{row[&#39;ColumnName&#39;]}&quot;,<br>                    &quot;type&quot;: f&quot;{row[&#39;DataType&#39;]}&quot;,<br>                },<br>                &quot;guid&quot;: f&quot;{resulttableguid[table_name]}{idx}&quot;,<br>                &quot;relationshipAttributes&quot;: {<br>                    &quot;table&quot;: {<br>                        &quot;guid&quot;: f&quot;{resulttableguid[table_name]}&quot;,<br>                        &quot;typeName&quot;: &quot;hive_table&quot;,<br>                    }<br>                },<br>            }<br>            iterationcount += 1<br>            data[&quot;entities&quot;].append(column_full_data)<br>            table_data[&quot;relationshipAttributes&quot;][&quot;columns&quot;].append(column_data)<br>        data[&quot;entities&quot;].append(table_data)<br>        # Keeping 20 JSON objects in array for API call similar to pagination<br>        if iterationcount % 20 == 0:<br>            response1 = requests.post(API_ENDPOINT_1, json=data, headers=headers)<br>            data = {&quot;entities&quot;: []}<br>        else:<br>            response1 = requests.post(API_ENDPOINT_1, json=data, headers=headers)<br>        return response1<br>    <br>def add_relationship():<br>    mappingarr = []<br>    colmapfinal = &quot;&quot;<br>    previous_row = None<br>    API_ENDPOINT_2 = (<br>        &quot;https://PURVIEW_NAME.purview.azure.com/datamap/api/atlas/v2/relationship&quot;<br>    )<br>    access_token = get_access_token()<br>    headers = {<br>        &quot;Authorization&quot;: f&quot;Bearer {access_token}&quot;,<br>        &quot;Content-Type&quot;: &quot;application/json&quot;,<br>    }<br>    resulttableguid=generate_guid()<br>    df2 = pd.read_excel(EXCEL_PATH, sheet_name=&quot;Dependency&quot;)<br>    for index, row in df2.iterrows():<br>        mapping = {&quot;Source&quot;: f&quot;{row[&#39;SourceColumn&#39;]}&quot;, &quot;Sink&quot;: f&quot;{row[&#39;SinkColumn&#39;]}&quot;}<br>        if previous_row is not None:<br>            if (row[&quot;SourceTable&quot;] == previous_row[&quot;SourceTable&quot;]) and (<br>                row[&quot;SinkTable&quot;] == previous_row[&quot;SinkTable&quot;]<br>            ):<br>                mappingarr.append(mapping)<br>            else:<br>                mappingarr = []<br>                colmapfinal = &quot;&quot;<br>                mappingarr.append(mapping)<br>        else:<br>            mappingarr.append(mapping)<br>        previous_row = row<br>        colmapfinal += json.dumps(mappingarr)<br>        datatemplate = {<br>            &quot;typeName&quot;: &quot;direct_lineage_dataset_dataset&quot;,<br>            &quot;guid&quot;: f&quot;{resulttableguid[row[&#39;SourceTable&#39;]]}&quot;,<br>            &quot;end1&quot;: {<br>                &quot;typeName&quot;: &quot;hive_table&quot;,<br>                &quot;guid&quot;: f&quot;{resulttableguid[row[&#39;SourceTable&#39;]]}&quot;,<br>                &quot;uniqueAttributes&quot;: {<br>                    &quot;qualifiedName&quot;: f&quot;test_lineage.{row[&#39;SourceTable&#39;]}&quot;<br>                },<br>            },<br>            &quot;end2&quot;: {<br>                &quot;typeName&quot;: &quot;hive_table&quot;,<br>                &quot;guid&quot;: f&quot;{resulttableguid[row[&#39;SinkTable&#39;]]}&quot;,<br>                &quot;uniqueAttributes&quot;: {<br>                    &quot;qualifiedName&quot;: f&quot;test_lineage.{row[&#39;SinkTable&#39;]}&quot;<br>                },<br>            },<br>            &quot;attributes&quot;: {&quot;columnMapping&quot;: colmapfinal},<br>        }<br>        response2 = requests.post(API_ENDPOINT_2, json=datatemplate, headers=headers)<br>        return response2<br><br>if __name__ == &quot;__main__&quot;:<br>    create_entity()<br>    add_relationship()<br>    print(&quot;Lineage creation successful!&quot;)</pre><h3>Visualizing Lineage</h3><p>After executing the Python script outlined earlier, we obtained the following lineage diagram representing the data flow between dimension and fact tables within Microsoft Purview:</p><p><strong>Note: </strong>Open <strong><em>Microsoft Purview Governance Portal (classic)</em></strong></p><ol><li>Access the portal and click “Data catalog” tab.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*6nt0XOhPoL87J9GpmyYj5w.png" /><figcaption>Data catalog tab in Microsoft Purview</figcaption></figure><p>2. To access lineage information, simply input the table name into the search catalog search box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*kx8QF1PaLo6l8FL_gd25Fg.png" /><figcaption>Search catalog in Microsoft Purview</figcaption></figure><p>3. Now, lineage diagram of the selected table will be displayed under “Lineage” tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*22g0beQaywrmHkxygfY1IA.png" /><figcaption><em>Lineage diagram illustrating the flow of data between dimension and fact tables in Microsoft Purview</em></figcaption></figure><p>4. You can view the complete list of columns in this table within the “properties” tab under the “column” section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/883/1*4T4IhIM6QNJW12oC6UYHnQ.png" /><figcaption>Column Names used in the Table</figcaption></figure><h3>Conclusion:</h3><p>So far, we’ve explored automating lineage mapping between dimension and fact tables in Microsoft Purview using Python. By leveraging pandas for data extraction and the Purview API for lineage propagation, organizations can simplify their data governance processes. Running the provided Python script ensures smooth execution, resulting in successful lineage relationships within Microsoft Purview. This automation enhances data transparency and compliance, empowering organizations to maximize the value of their data assets.</p><h3>About Us:</h3><p>Bi3 has been recognized for being one of the fastest-growing companies in Australia. Our team has delivered substantial and complex projects for some of the largest organizations around the globe, and we’re quickly building a brand that is well-known for superior delivery.</p><blockquote><strong><em>Website:</em></strong><em> </em><a href="https://bi3technologies.com/"><em>https://bi3technologies.com/</em></a></blockquote><blockquote><em>Follow us on,<br></em><strong><em>LinkedIn: </em></strong><a href="https://www.linkedin.com/company/bi3technologies"><em>https://www.linkedin.com/company/bi3technologies</em></a><em><br></em><strong><em>Instagram:</em></strong><em> </em><a href="https://www.instagram.com/bi3technologies/"><em>https://www.instagram.com/bi3technologies/</em></a><em><br></em><strong><em>Twitter:</em></strong><em> </em><a href="https://twitter.com/Bi3Technologies"><em>https://twitter.com/Bi3Technologies</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d3bc023b881" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bi3-technologies/simplifying-lineage-mapping-in-microsoft-purview-a-python-approach-1d3bc023b881">Simplifying Lineage Mapping in Microsoft Purview: A Python Approach</a> was originally published in <a href="https://medium.com/bi3-technologies">BI3 Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Azure Cognitive Services with Snowflake External Functions]]></title>
            <link>https://medium.com/bi3-technologies/use-azure-cognitive-services-with-snowflake-external-functions-f9bcf07a871?source=rss-86c735963886------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9bcf07a871</guid>
            <category><![CDATA[azure-api-management]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[cognitive-services]]></category>
            <category><![CDATA[text-analytics]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Rasika Eshwar]]></dc:creator>
            <pubDate>Fri, 29 Oct 2021 06:48:02 GMT</pubDate>
            <atom:updated>2021-12-10T07:45:18.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZ9CxNUBeDDJGDOdHL_xuA.png" /></figure><p>This blog will show you how to use Snowflake External Functions to interact with Azure.</p><h3>1. Create Cognitive Services in Text Analytics</h3><p>To begin, follow the steps below to create text analytics.</p><p><strong>Step 1: </strong>Select <strong>Create a resource</strong>, and then go to <strong>AI + Machine Learning</strong> &gt; <strong>Text Analytics</strong>. Or go to <a href="https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics">Create Text Analytics</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*eeoYwZbMpJoDlFfwlAC9UA.png" /><figcaption>Cognitive Services</figcaption></figure><p><strong>Step 2:</strong> Enter all the required settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*fRwMhf9VQCNSPbguEskwwg.png" /></figure><p><strong>Step 3: </strong>Select <strong>Create</strong> and wait for the resource to be created. Your browser automatically redirects to the newly created resource page.</p><p><strong>Step 4:</strong> The created text analytics is visible under text analytics tab. bi3mlpoc is the text analytics created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*IK8y4QgRN3nntHp82TPQ0g.png" /><figcaption>Created Text Analytics in Cognitive Services</figcaption></figure><p>Collect the configured endpoint and an API key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*MumZoEa_KdwFD4dEqZHRPw.png" /><figcaption>Keys and Endpoint of Created Text Analytics</figcaption></figure><p>Since Snowflake cannot call the function app URL directly, we need to create an API gateway as a proxy.</p><h3>2. Create API Gateway</h3><p>Follow the steps below to create an API gateway.</p><p><strong>Step 1:</strong> From the Azure portal menu, select <strong>Create a resource</strong>. You can also select <strong>Create a resource</strong> on the Azure <strong>Home</strong> page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*TzNv6I5pkfMlnj4p8n5hIg.png" /><figcaption>Create a resource</figcaption></figure><p><strong>Step 2: </strong>On the <strong>New</strong> page, select <strong>Integration</strong> &gt; <strong>API Management</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/1*dKpFCgUmq0UwG4FHzNZbFw.png" /><figcaption>API Management in Integration</figcaption></figure><p><strong>Step 3: </strong>In the <strong>API Management service</strong> page, enter settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*wH7fP0adUXUj3kygmpRsjA.png" /></figure><p><strong>Step 4 : </strong>Select <strong>Create</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*Ljz_n57Hx2uFqdsfI2KqVQ.png" /><figcaption>Create API Management Service</figcaption></figure><p>On the <strong>API Management services</strong> page, select your API Management instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*5dZ0nn_gnm-Y0DlPmsRxWQ.png" /><figcaption>List of Created API Management Service</figcaption></figure><h3>3.Create Function App</h3><p>To create and deploy Function App through Visual Studio follow below steps.</p><p><strong>Step 1:</strong> Choose the Azure icon in the Activity bar, then in the <strong>Azure: Functions</strong> area, select the <strong>Create new project…</strong> icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMShNdYbmaMitKBKUHpazQ.png" /><figcaption>Create a new project in Visual Studio</figcaption></figure><p><strong>Step 2:</strong> Choose a directory location for your project workspace and choose <strong>Select</strong>.</p><p><strong>Note: </strong>These steps were designed to be completed outside of a workspace. In this case, do not select a project folder that is part of a workspace.</p><p><strong>Step 3: </strong>Provide the information for the prompts</p><p>Create a new file and enter the below code. This C# code will trigger bi3mlpoc text analytics in cognitive services.</p><pre>using System;<br>using System.IO;<br>using System.Threading.Tasks;<br>using Microsoft.AspNetCore.Mvc;<br>using Microsoft.Azure.WebJobs;<br>using Microsoft.Azure.WebJobs.Extensions.Http;<br>using Microsoft.AspNetCore.Http;<br>using Microsoft.Extensions.Logging;<br>using Newtonsoft.Json;<br>using System.Globalization;<br>using Azure.AI.TextAnalytics;<br>using Azure;<br>using System.Collections;<br>using System.Collections.Generic;</pre><pre>namespace Company.Function.SentimentAnalysis<br>{</pre><pre>public class responsedata<br> {<br> public ArrayList data {get; set;}<br> }</pre><pre>public class Root<br> {<br> public List&lt;List&lt;object&gt;&gt; data { get; set; }<br> }</pre><pre>public static class SentimentAnalysis<br> {<br> private static readonly AzureKeyCredential credentials = new AzureKeyCredential(“8dxxxsdaxxxxxxx46a1e2”);<br> private static readonly Uri endpoint = new Uri(<a href="https://bi3mlpoc.cognitiveservices.azure.com/">https://bi3mlpoc.cognitiveservices.azure.com/</a>);<br> [FunctionName(“SentimentAnalysis”)]<br> public static async Task&lt;IActionResult&gt; Run(<br> [HttpTrigger(AuthorizationLevel.Anonymous, “get”, “post”, Route = null)] HttpRequest req,<br> ILogger log)<br> {</pre><pre>responsedata rd = new responsedata();<br> var client = new TextAnalyticsClient(endpoint, credentials);<br> string name = req.Query[“name”];<br> string requestBody = await new StreamReader(req.Body).ReadToEndAsync();<br> Root myDeserializedClass = JsonConvert.DeserializeObject&lt;Root&gt;(requestBody);<br> int i= 0;<br> var overallarray = new ArrayList();<br> var rowArray = new ArrayList();<br> var columnArray = new ArrayList();<br> string inputText = string.Empty;</pre><pre>foreach(List&lt;Object&gt; datarow in myDeserializedClass.data ) <br> {</pre><pre>rowArray = new ArrayList();<br> columnArray = new ArrayList();<br> rowArray.Add(datarow[0]);<br> inputText = datarow[1].ToString();<br> DocumentSentiment documentSentiment = client.AnalyzeSentiment(inputText); <br> columnArray.Add(JsonConvert.SerializeObject(documentSentiment));<br> rowArray.Add(columnArray);<br> overallarray.Add(rowArray);<br> <br> }</pre><pre>rd.data= overallarray;<br> return new OkObjectResult(rd);<br> }<br> }<br>}</pre><p><em>Run the function locally</em></p><p>i. To call your function, press F5 to start the function app project. Output from Core Tools is displayed in the <strong>Terminal</strong> panel. Your app starts in the <strong>Terminal</strong> panel.</p><p>ii. With Core Tools running, go to the <strong>Azure: Functions</strong> area. Under <strong>Functions</strong>, expand <strong>Local Project</strong> &gt; <strong>Functions</strong>. Right-click (Windows) or Ctrl — click (macOS) the HttpExample function and choose <strong>Execute Function Now</strong></p><p>iii. Press Ctrl + C to stop Core Tools and disconnect the debugger.</p><p><em>Sign into Azure</em></p><p>If you aren’t already signed in, choose the Azure icon in the Activity bar, then in the <strong>Azure: Functions</strong> area, choose <strong>Sign in to Azure</strong></p><p><em>Publish the project to Azure</em></p><p>Choose the Azure icon in the Activity bar, then in the <strong>Azure: Functions</strong> area, choose the <strong>Deploy to function app…</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tZNoOAweypcw0RxlmP9u6A.png" /><figcaption>Deploy Function App to Azure</figcaption></figure><p>ii. Provide the following information at the prompts:</p><p><strong>-&gt;</strong> Select folder</p><p><strong>-&gt;</strong> Select subscription</p><p><strong>-&gt; </strong>Choose Create New Function App</p><p><strong>-&gt; </strong>Enter a globally unique name for the function app</p><p><strong>-&gt; </strong>Select a location for new resources</p><p>The extension shows the status of individual resources as they are being created in Azure in the notification area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOe69T1Kjw0Ze6ddH6Nulg.png" /><figcaption>Creating New Function App</figcaption></figure><p>A notification is displayed after your function app is created and the deployment package is applied.</p><p><strong>Tip: </strong>By default, the Azure resources required by your function app are created based on the function app name you provide. By default, they are also created in the same new resource group with the function app. If you want to either customize the names of these resources or reuse existing resources, you need to instead <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-vs-code#enable-publishing-with-advanced-create-options">publish the project with advanced create options</a>.</p><p>2. Select <strong>View Output</strong> in this notification to view the creation and deployment results, including the Azure resources that you created. If you miss the notification, select the bell icon in the lower right corner to see it again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C81AbfmZjKPxWJ--uBLceg.png" /><figcaption>View Output of Function App</figcaption></figure><h3><strong>4. Add API to created Function App</strong></h3><p><strong>Step 1: </strong>Click on the created service, In the API tab click on Function App as shown below,<br> From the left menu of the <strong>APIs</strong> window, select <strong>APIs</strong>, then select <strong>Add</strong> from the top menu.</p><p><strong>Step 2: </strong>From the <strong>Add APIs</strong> window, select the <strong>Function App</strong> template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*moOjgQoJGyb1OovfrXFoMA.png" /><figcaption>Add API in API Management Service</figcaption></figure><p>This will show a pop up, click on browse to choose function app, and select the deployed function app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*fSgwPR4KRxDbosg9HLzUtA.png" /><figcaption>Import Function App in API Management Service</figcaption></figure><h3>5. Create Snowflake API integration</h3><p>Create API integration in snowflake as below,</p><pre>create or replace api integration SNOWFLAKE_SAFEGUARD_NONPROD_INTEGRATION_1<br>enabled = TRUE <br>API_PROVIDER=azure_api_management<br>API_KEY =&#39;aaf288xxxx2chbec4&#39;<br>AZURE_TENANT_ID= &#39;758732axxxxx1e0bbja3&#39;<br>AZURE_AD_APPLICATION_ID=&#39;0bbc8d65axxxxxaec71eh095&#39;<br>api_allowed_prefixes = (&#39;<a href="https://bi3-poc-apimanagement.azure-api.net&/#39;">https://bi3-poc-apimanagement.azure-api.net&#39;</a>);</pre><p>Admin role should approve to call the AZURE consent URL.</p><h3>6. Create Snowflake Function</h3><p>Create a function to call API integration in snowflake.</p><pre>create or replace external function FN_SNOWFLAKE_EXTERNAL_FUNCTION_SENTIMENT_ANALYSIS(body varchar)<br>returns variant<br>volatile<br>api_integration = SNOWFLAKE_SAFEGUARD_NONPROD_INTEGRATION_1<br>HEADERS =(‘Host’=’bi3-poc-apimanagement.azure-api.net’<br>,’Ocp-Apim-Trace’=’true’<br>,’Ocp-Apim-Subscription-Key’=’a51969axxxxxf5341&#39;<br>) as ‘<a href="https://bi3-poc-apimanagement.azure-api.net/snowflakeexternalfunction/SentimentAnalysis&#39;">https://bi3-poc-apimanagement.azure-api.net/snowflakeexternalfunction/SentimentAnalysis&#39;</a></pre><p><strong>Note:</strong> There is a limitation that we have pass the body in function but not the headers. Headers can be hard coded into the function.</p><h3>7. Create Snowflake TABLE</h3><p>Create a table that contains inputs to the above created function in snowflake as below.</p><pre>CREATE OR REPLACE TABLE DEMO_DB.INCUBATION_TESTING.SENTIMENT_ANALYSIS<br>AS <br>SELECT CAST(‘This is very good job :-)’ aS VARCHAR) AS feedback<br>UNION ALL<br>SELECT ‘this is a bad job :-)’<br>UNION ALL<br>SELECT ‘i am not vastly satisfied with the work, but i understand the problem’;</pre><p>The created table will provide below result set.</p><pre> SELECT * from DEMO_DB.INCUBATION_TESTING.SENTIMENT_ANALYSIS;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*JOwImLFowV_nm7xygTLdiw.png" /><figcaption>Result Set of above Select query</figcaption></figure><p>Using below select query it will provide corresponding outputs.</p><pre>SELECT feedback, FN_SNOWFLAKE_EXTERNAL_FUNCTION_SENTIMENT_ANALYSIS(feedback) AS sentiment_analysis FROM DEMO_DB.INCUBATION_TESTING.SENTIMENT_ANALYSIS;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*tLp_SMa0f4G6ITkLRfOBUA.png" /><figcaption>Result Set of above Select query</figcaption></figure><p>Finally, with the inputs provided through the Snowflake external function, we received the desired result from text analytics in Azure.</p><h3>About Us</h3><p>Bi3 has been recognized for being one of the fastest-growing companies in Australia. Our team has delivered substantial and complex projects for some of the largest organizations around the globe and we’re quickly building a brand that is well known for superior delivery.</p><p><em>Website : </em><a href="https://bi3technologies.com/"><em>https://bi3technologies.com/</em></a></p><p>Follow us on,<br><em>LinkedIn : </em><a href="https://www.linkedin.com/company/bi3technologies"><em>https://www.linkedin.com/company/bi3technologies</em></a><em><br>Instagram : </em><a href="https://www.instagram.com/bi3technologies/"><em>https://www.instagram.com/bi3technologies/</em></a><em><br>Twitter : </em><a href="https://twitter.com/Bi3Technologies"><em>https://twitter.com/Bi3Technologies</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9bcf07a871" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bi3-technologies/use-azure-cognitive-services-with-snowflake-external-functions-f9bcf07a871">Use Azure Cognitive Services with Snowflake External Functions</a> was originally published in <a href="https://medium.com/bi3-technologies">BI3 Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>