<?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 Prateek Parashar on Medium]]></title>
        <description><![CDATA[Stories by Prateek Parashar on Medium]]></description>
        <link>https://medium.com/@prateekparashar2386?source=rss-5702f8cda39d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dNR67Aoy9l0oSvW5</url>
            <title>Stories by Prateek Parashar on Medium</title>
            <link>https://medium.com/@prateekparashar2386?source=rss-5702f8cda39d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:32:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prateekparashar2386/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[Sync documents from sharepoint to snowflake with Microsoft Graph APIs and snowpark container…]]></title>
            <link>https://medium.com/snowflake/syncing-documents-from-sharepoint-to-snowflake-by-leveraging-microsoft-graph-apis-in-snowpark-b97a423d71db?source=rss-5702f8cda39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b97a423d71db</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[unstructured-data]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[sharepoint]]></category>
            <dc:creator><![CDATA[Prateek Parashar]]></dc:creator>
            <pubDate>Mon, 15 Jul 2024 20:13:22 GMT</pubDate>
            <atom:updated>2025-11-16T22:59:54.551Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sync documents from sharepoint to snowflake with Microsoft Graph APIs and snowpark container services</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwSpW4ySPM1xgw1QxXVttg.jpeg" /></figure><p><strong>Nov 16th, 2025: Update — </strong>Datavolo is available in snowflake as <a href="https://docs.snowflake.com/en/user-guide/data-integration/openflow/about">Openflow</a>, an integration service that connects any data source and any destination with hundreds of processors supporting structured and unstructured text, images, audio, video and sensor data. <a href="https://docs.snowflake.com/en/user-guide/data-integration/openflow/connectors/sharepoint/about">Sharepoint is one of the many sources that openflow would support</a> ingesting data from. <em>As mentioned previously, if you’re interested in learning about integrating Snowflake with other Microsoft services using Graph APIs — this article can serve as a reference for that.</em></p><p><strong>Jan 25th, 2025: Update</strong> — Snowflake’s <a href="https://www.snowflake.com/en/engineering-blog/snowflake-datavolo-multimodal-data-integration-platform/">intent to acquire Datavolo</a> will introduce more streamlined ways of landing unstructured data into your snowflake account, in that — you’re not having to brute ingest unstructured documents but can also potentially keep the data in sync with whatever your source is, including sharepoint. This means you can inspect document metadata for authorization changes on the source side and have those access controls maintained on the snowflake side. Speak to your account team to learn more about how Datavolo capabilities will be made available as part of Snowflake product.</p><p><strong>Jan 3, 2025: Update — </strong>Since I wrote this article, we have <a href="https://docs.snowflake.com/en/connectors/unstructured-data-connectors/sharepoint/about">launched a native connector for sharepoint</a> which would provide a more seamless, out of the box experience when syncing documents from sharepoint to Snowflake. Recommendation would be to use this connector instead of the custom solution explained here or any other custom solution for that matter. The article can still serve as a reference for integrating Snowflake with Microsoft services using Graph APIs.</p><p><em>With the arrival of serverless LLM functions in cortex, Snowflake customers now have access to enterprise grade LLM models that are easy to use and cost effective too. Many of the LLM based solutions like RAG applications rely on a rich corpus of documents which are often found on popular CMS applications like sharepoint. In this article we demonstrate using Microsoft graph APIs with Snowpark container services to pull these documents into snowflake to power snowflake native AI apps.</em></p><h3>Overview</h3><p>Documents powering RAG applications is now popular folklore and data platforms like snowflake are coming out all guns blazing to ensure customers have everything they need for building the next gen full-stack data apps natively. This includes support for processing unstructured data, easy access to LLM models, vector capabilities etc. Given that the world is reimagining solutions around GenAI, documents — specifically in a RAG application — play a crucial role in enriching these solutions by serving as an extended knowledge base and supporting contextual retrieval based on specific and pertinent data available, improving the overall relevance and accuracy of responses. For your org, if this corpus of documents is available in sharepoint and you wish to bring them into snowflake to leverage all of snowflake’s native goodness. This article lays out a simple SPCS based approach to achieve this.</p><h3>Solution Design</h3><p>For the purpose of this exercise we’ve created a temporary sharepoint site on a microsoft 365 E3 subscription, registered an enterprise app and granted graph API permissions for the service-principal to be able to communicate with the sharepoint app. At the end of this article you’ll find screengrabs of all entities needed from microsoft entra and sharepoint in order to establish a trust relationship between them and snowflake.</p><p>This will broadly be a 3 step solution</p><ol><li><strong>Create python stored procedures</strong>: We’ll create two stored procedures with external access for generating access token for authenticating requests to Graph APIs and subsequently fetch site id and folder id for the respective sharepoint site and folder from which we will be fetching the documents.</li><li><strong>Setup snowpark container services:</strong> We’ll use fastapi for building Restful APIs and direct calls from service function in snowflake to a defined endpoint. We’ll also use gunicorn as the WSGI http server.</li><li><strong>Deploy solution as a service function:</strong> Once the container image is prepare and uploaded to an image repository in snowflake, we’ll deploy an SPCS service function on top as an interface to our containerized solution.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tw_vb2TkTXkRUbvetnuVFg.png" /><figcaption>Solution design for pulling documents from sharepoint into snowflake.</figcaption></figure><h3>Code Organization</h3><p>We’ve organized code in different databases for this demo:</p><ul><li><strong>COMMON.UTILITY</strong> : This schema will host all of our generic objects that can potentially be reused for other use cases, it will contain the authentication stored procedures for communicating with graph APIs, network rules, secret object for storing and retrieving the graph API client secret and an internal stage that will house the custom packages needed. There are two custom packages that you will need to upload to an internal stage called package_stage, those packages are listed below<br>- <a href="https://pypi.org/project/Office365-REST-Python-Client/#modal-close">Office365_REST_Python_Client-2.5.11-py3-none-any.whl</a><br>- <a href="https://github.com/Snowflake-Labs/snowpark-extensions-py/blob/02cf881546a7c4001df87340e14726a99844b849/extras/wheel_loader/wheel_loader.py">wheel_loader.py</a></li><li><strong>DEMO_DB.SHAREPOINT : </strong>This schema will contain all objects specific to this demo and required for creating the sharepoint service — this includes all of the SPCS code like the SPCS service, service-functions, image repository etc.</li></ul><h3>Create stored procedures to access microsoft graph APIs</h3><p>Our stored procs need to have external network access to be able to communicate with graph APIs, lets set these up first</p><p>We’ll setup a network rule that’ll permit our stored procs to reach out to the necessary microsoft URLs for authentication. We also need to safely store our client secret in snowflake’s newly lauched <a href="https://docs.snowflake.com/en/developer-guide/external-network-access/creating-using-external-network-access#creating-a-secret-to-represent-credentials">secrets object</a>.</p><p>Together , the network rule and the authentication secret will be associated with an external access integration object which will allow our procedures to reach out to the necessary end points.</p><h4>Create objects to negotiate with Graph APIs</h4><pre>use role sysadmin;<br>create database if not exists common;<br>create schema if not exists utility;<br><br>use role accountadmin;<br>use schema common.utility;<br>use warehouse poc_wh;<br><br>--For service to communicate with certain endpoints pypi etc. - requires egress oauth<br>CREATE OR REPLACE NETWORK RULE pip_network_rule<br>  MODE = EGRESS<br>  TYPE = HOST_PORT<br>  VALUE_LIST = (&#39;pypi.python.org&#39;);<br><br>create or replace network rule sharepoint_apis_network_rule<br>  MODE = EGRESS<br>  TYPE = HOST_PORT<br>  VALUE_LIST = (&#39;login.microsoftonline.com&#39;);<br><br>-- Add your sharepoint site name, look at the screenshot at the bottom<br>-- of the article if you&#39;re not sure what this value should be.<br>alter network rule sharepoint_apis_network_rule set <br>value_list = (<br>&#39;login.microsoftonline.com&#39;,<br>&#39;&lt;your sharepoint site name&gt;&#39;,<br>&#39;accounts.accesscontrol.windows.net&#39;,<br>&#39;graph.microsoft.com&#39;<br>);<br><br>use role sysadmin;<br>create or replace secret azure_auth<br>    type = GENERIC_STRING<br>    secret_string = &#39;&lt;Your client Secret&gt;&#39;;<br><br>use role accountadmin;<br>--For stored procs<br>create or replace external access integration sharepoint_site_int<br>    allowed_network_rules = (sharepoint_apis_network_rule)<br>    allowed_authentication_secrets = (azure_auth)<br>    enabled = true;<br><br>--For SPCS service function<br>CREATE or replace EXTERNAL ACCESS INTEGRATION sp_pip_access<br>  ALLOWED_NETWORK_RULES = (sharepoint_apis_network_rule, pip_network_rule)<br>  ENABLED = true;<br><br>--Grant access to these objects to a lower role<br>grant usage on network rule pip_network_rule to role sysadmin;<br>grant usage on network rule sharepoint_apis_network_rule to role sysadmin;<br>grant usage on integration sp_pip_access to role sysadmin;<br>grant usage on integration sharepoint_site_int to role sysadmin;</pre><h4>Generate sharepoint access token</h4><p>Our first stored proc is limited in scope to only obtain access token, we’re modularizing it this way to use it for other graph API related use cases that we might encounter in the future.</p><pre>use role sysadmin;<br>use schema common.utility;<br><br><br>--Upload office365 rest python client library and the wheel loader library<br>create stage package_stage;<br><br>--Generate sharepoint access token<br>--Make sure the custom packages have been uploaded to the package_stage<br>--internal stage<br>CREATE OR REPLACE PROCEDURE COMMON.UTILITY.office365_get_sharepoint_access_token(client_id string,tenant_id string,sharepoint_url string, sharepoint_site string) <br>RETURNS text <br>LANGUAGE PYTHON RUNTIME_VERSION = &#39;3.8&#39; <br>PACKAGES = (&#39;snowflake-snowpark-python==1.2.0&#39;,&#39;requests&#39;) <br>imports = (&#39;@package_stage/wheel_loader.py&#39;,&#39;@package_stage/Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>external_access_integrations = (sharepoint_site_int)<br>HANDLER = &#39;main&#39;<br>secrets = (&#39;cred&#39;= azure_auth)<br>EXECUTE AS OWNER <br>AS <br>$$ <br>import requests<br>import sys<br>import os<br>import wheel_loader<br>import_dir = sys._xoptions.get(&#39;snowflake_import_directory&#39;) <br>sys.path.append(import_dir + &#39;/Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>import _snowflake<br>wheel_loader.load(&#39;Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>from office365.runtime.auth.authentication_context import AuthenticationContext<br><br>def main(session,client_id,tenant_id,sharepoint_url,sharepoint_site):<br>    # get secret<br>    client_secret = _snowflake.get_generic_secret_string(&#39;cred&#39;)<br>    <br>    # create credentials for graph API<br>    site_url = f&#39;https://graph.microsoft.com/v1.0/sites/{sharepoint_url}&#39;<br>    app_principal = {<br>    &#39;client_id&#39;: client_id,<br>    &#39;client_secret&#39;: client_secret,<br>    }<br><br>    context_auth = AuthenticationContext(url=site_url)<br>    context_auth.acquire_token_for_app(client_id=app_principal[&#39;client_id&#39;], <br>    client_secret=app_principal[&#39;client_secret&#39;])<br>    request_url = f&#39;https://login.microsoftonline.com/{tenant_id}/oauth2/token&#39;<br>    response = requests.post(request_url, <br>    data= {&quot;grant_type&quot;: &quot;client_credentials&quot;,<br>           &quot;client_id&quot;:client_id,<br>           &quot;client_secret&quot;:client_secret,<br>           &quot;resource&quot;:&quot;https://graph.microsoft.com&quot;}<br>    )<br>    return response.json()[&quot;access_token&quot;]<br>$$;<br><br>--Test stored procedure to ensure access token generation<br>--If you&#39;re unsure of where to get these values - see screengrabs available<br>--at the end of this article<br>call office365_get_sharepoint_access_token(<br>  client_id =&gt; &#39;&lt;client id&gt;&#39;,<br>  tenant_id =&gt; &#39;&lt;tenant id&gt;&#39;,<br>  sharepoint_url =&gt; &#39;&lt;sharepoint url&gt;&#39;,<br>  sharepoint_site =&gt; &#39;&lt;sharepoint site&gt;&#39;<br>);</pre><p>Once we’ve successfully authenticated with Graph APIs we can obtain site id and folder id for the sharepoint site and folder in which the documents exist.</p><pre>CREATE OR REPLACE PROCEDURE COMMON.UTILITY.office365_get_sharepoint_site_details(client_id string,tenant_id string,sharepoint_url string,sharepoint_site string,sharepoint_folder string) <br>RETURNS variant <br>LANGUAGE PYTHON RUNTIME_VERSION = &#39;3.8&#39; <br>PACKAGES = (&#39;snowflake-snowpark-python==1.2.0&#39;,&#39;requests&#39;) <br>imports = (&#39;@package_stage/wheel_loader.py&#39;,&#39;@package_stage/Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>external_access_integrations = (sharepoint_site_int)<br>HANDLER = &#39;main&#39;<br>secrets = (&#39;cred&#39;= azure_auth)<br>EXECUTE AS OWNER <br>AS <br>$$ <br>import requests<br>import sys<br>import os<br>import wheel_loader<br>import json<br>import_dir = sys._xoptions.get(&#39;snowflake_import_directory&#39;) <br>sys.path.append(import_dir + &#39;/Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>import _snowflake<br>wheel_loader.load(&#39;Office365_REST_Python_Client-2.5.6-py3-none-any.whl&#39;)<br>from office365.runtime.auth.authentication_context import AuthenticationContext<br><br>def main(session,client_id,tenant_id,sharepoint_url,sharepoint_site,sharepoint_folder):<br>    <br><br>    #Get secret<br>    client_secret = _snowflake.get_generic_secret_string(&#39;cred&#39;)<br>    sharepoint_ids = dict.fromkeys([&#39;site_id&#39;,&#39;folder_id&#39;])<br>    <br>    # create credentials <br>    <br>    site_url = &#39;https://graph.microsoft.com/v1.0/sites/&#39; + sharepoint_url<br>    app_principal = {<br>    &#39;client_id&#39;: client_id,<br>    &#39;client_secret&#39;: client_secret,<br>    }<br>    request_url = &#39;https://graph.microsoft.com/v1.0/sites?search=&#39; + sharepoint_site<br>    <br>    context_auth = AuthenticationContext(url=site_url)<br>    context_auth.acquire_token_for_app(client_id=app_principal[&#39;client_id&#39;], <br>    client_secret=app_principal[&#39;client_secret&#39;])<br><br>    args = (client_id,tenant_id,sharepoint_url,sharepoint_site)<br>    get_token_sql = &#39;&#39;&#39;call office365_get_sharepoint_access_token(<br>    client_id =&gt; &#39;{0}&#39;,<br>    tenant_id =&gt; &#39;{1}&#39;,<br>    sharepoint_url =&gt; &#39;{2}&#39;,<br>    sharepoint_site =&gt; &#39;{3}&#39;<br>    )&#39;&#39;&#39;.format(*args)<br>    token = session.sql(get_token_sql).collect()[0][0]<br>    auth = &quot;Bearer &quot; + token<br><br>    response = requests.get(<br>    request_url,<br>    headers={&quot;Authorization&quot;: auth},<br>    )<br><br>    if response.json()[&#39;value&#39;]:<br>        site_response = response.json()[&#39;value&#39;][0][&#39;id&#39;]<br>        site_id = site_response.split(&#39;,&#39;)[1]<br>        sharepoint_ids[&#39;site_id&#39;] = site_id<br>    <br>        #Get folder id<br>        folder_request_url = &#39;https://graph.microsoft.com/v1.0/sites/&#39; + site_response + &#39;/drive/root:/&#39; + sharepoint_folder + &#39;?&#39;<br>        auth = &quot;Bearer &quot; + token<br>        <br>        response = requests.get(<br>        folder_request_url,<br>        headers={&quot;Authorization&quot;: auth},<br>        )<br>        if response.status_code == 200:    <br>            folder_id = response.json()[&#39;id&#39;]<br>            sharepoint_ids[&#39;folder_id&#39;] = folder_id<br>        else:<br>            sharepoint_ids[&#39;folder_id&#39;] = &#39;&#39;<br>    else:<br>        sharepoint_ids[&#39;site_id&#39;] = &#39;&#39;<br>        sharepoint_ids[&#39;folder_id&#39;] = &#39;&#39;<br>    return sharepoint_ids<br>$$;<br><br>--Test stored procedure to ensure generation of site_id and folder_id<br>call office365_get_sharepoint_site_details(<br>  client_id =&gt; &#39;&lt;client id&gt;&#39;,<br>  tenant_id =&gt; &#39;&lt;tenant id&gt;&#39;,<br>  sharepoint_url =&gt; &#39;&lt;sharepoint url&gt;&#39;, <br>  sharepoint_site =&gt; &#39;&lt;sharepoint site&gt;&#39;,<br>  sharepoint_folder =&gt; &#39;&lt;sharepoint folder&gt;&#39;<br>);</pre><h3>Snowpark container service code</h3><p>We’ll now start readying our SPCS code on a local laptop or dev server. You should create a base working folder when preparing the docker package, inside the base folder you want to create an <em>app</em> folder which will have a subfolder called <em>msft_graph_api</em>. You don’t necessarily have to stick to this nomenclature and/or folder hierarchy if you’re able to tweak reference to these scripts in the Dockerfile as needed. But you would need this nomenclature and folder structure if you intend to use the code snippets provided here as is.</p><p><strong>app/webservice.py</strong></p><p>We’ll first create a wrapper service to listen to any incoming requests on a defined endpoint, in our case we’re defining that as <em>download-docs</em>. This wrapper service will parse inbound arguments and pass it on to an underlying get_files function which will fetch documents for us from a resource URI which we will form based on site_id and folder_id values.</p><pre>import logging<br>import sys<br>import numpy as np<br>from fastapi import FastAPI, Request, Query<br>from msft_graph_api.core import get_files<br><br># Logging<br>def get_logger(logger_name):<br>   logger = logging.getLogger(logger_name)<br>   logger.setLevel(logging.DEBUG)<br>   handler = logging.StreamHandler(sys.stdout)<br>   handler.setLevel(logging.DEBUG)<br>   handler.setFormatter(<br>      logging.Formatter(<br>      &#39;%(name)s [%(asctime)s] [%(levelname)s] %(message)s&#39;))<br>   logger.addHandler(handler)<br>   return logger<br>logger = get_logger(&#39;snowpark-container-service&#39;)<br><br>app = FastAPI()<br><br>@app.post(&quot;/download-docs&quot;, tags=[&quot;Endpoints&quot;])<br>async def download_docs(request: Request):<br>   # audio_file: Union[str, None] = Query(default=None),<br>   # encode : bool = Query(default=True, description=&quot;Encode audio first through ffmpeg&quot;)<br>   request_body = await request.json()<br>   request_body = request_body[&#39;data&#39;]<br>   return_data = []<br>   client_id = request_body[0][1]<br>   tenant_id = request_body[0][2]<br>   sharepoint_url = request_body[0][3]<br>   sharepoint_site = request_body[0][4]<br>   sharepoint_folder = request_body[0][5]<br>   output_msg = get_files(client_id,tenant_id,sharepoint_url,sharepoint_site,sharepoint_folder)<br>   return_data.append([0,output_msg])<br>   <br>   return {&quot;data&quot;: return_data}</pre><p><strong>app/msft_graph_api/core.py</strong></p><p>This is our core module that is executing the API calls to fetch documents and committing them to an internal stage available to our container as a volume mount.</p><pre>import logging<br>import requests<br>import sys, os<br>from office365.sharepoint.client_context import ClientContext<br>from office365.runtime.auth.client_credential import ClientCredential<br>from office365.runtime.auth.authentication_context import AuthenticationContext<br>from snowflake.snowpark import Session<br>import json<br><br># Establish snowpark session<br>def get_token():<br>    with open(&#39;/snowflake/session/token&#39;, &#39;r&#39;) as f:<br>        return f.read()<br><br>def create_snowflake_session():<br>    connection_params = {<br>        &#39;host&#39;: os.environ[&#39;SNOWFLAKE_HOST&#39;],<br>        &#39;port&#39;: os.environ[&#39;SNOWFLAKE_PORT&#39;],<br>        &#39;protocol&#39;: &#39;https&#39;,<br>        &#39;account&#39;: os.environ[&#39;SNOWFLAKE_ACCOUNT&#39;],<br>        &#39;authenticator&#39;: &#39;oauth&#39;,<br>        &#39;token&#39;: get_token(),<br>        &#39;role&#39;: os.environ[&#39;SNOW_ROLE&#39;],<br>        &#39;warehouse&#39;: os.environ[&#39;SNOW_WAREHOUSE&#39;],<br>        &#39;database&#39;: os.environ[&#39;SNOW_DATABASE&#39;],<br>        &#39;schema&#39;: os.environ[&#39;SNOW_SCHEMA&#39;]<br>    }<br>    session = Session.builder.configs(connection_params).create()<br>    return session<br><br><br># Logging<br>def get_logger(logger_name):<br>   logger = logging.getLogger(logger_name)<br>   logger.setLevel(logging.DEBUG)<br>   handler = logging.StreamHandler(sys.stdout)<br>   handler.setLevel(logging.DEBUG)<br>   handler.setFormatter(<br>      logging.Formatter(<br>      &#39;%(name)s [%(asctime)s] [%(levelname)s] %(message)s&#39;))<br>   logger.addHandler(handler)<br>   return logger<br>logger = get_logger(&#39;snowpark-container-service&#39;)<br><br>def get_files(client_id: str,<br>    tenant_id: str,<br>    sharepoint_url: str,<br>    sharepoint_site: str,<br>    sharepoint_folder: str<br>):<br>    session = create_snowflake_session()<br>    <br>    GRAPH_URL = &#39;https://graph.microsoft.com/v1.0&#39;<br><br>    # create credentials <br>    <br>    #site_url = &#39;https://graph.microsoft.com/v1.0/sites/testorg236.sharepoint.com&#39;<br>    site_url = &#39;https://graph.microsoft.com/v1.0/sites/&#39; + sharepoint_url<br>    app_principal = {<br>        &#39;client_id&#39;: client_id,<br>        &#39;client_secret&#39;: os.environ[&#39;GENERIC_SECRET&#39;], <br>    }<br>    context_auth = AuthenticationContext(url=site_url)<br>    context_auth.acquire_token_for_app(client_id=app_principal[&#39;client_id&#39;], <br>    client_secret=app_principal[&#39;client_secret&#39;])<br>    <br>    args = (client_id,tenant_id,sharepoint_url,sharepoint_site)<br>    get_token_query = &#39;&#39;&#39;<br>    call common.utility.office365_get_sharepoint_access_token(<br>    client_id =&gt; &#39;{0}&#39;,<br>    tenant_id =&gt; &#39;{1}&#39;,<br>    sharepoint_url =&gt; &#39;{2}&#39;,<br>    sharepoint_site =&gt; &#39;{3}&#39;)<br>    &#39;&#39;&#39;.format(*args)<br>    token = session.sql(get_token_query).collect()[0][0]<br>    <br>    #Get necessary Sharepoint IDs<br>    args = (client_id,tenant_id,sharepoint_url,sharepoint_site,sharepoint_folder)<br>    sharepoint_details_query = &#39;&#39;&#39;<br>    call common.utility.office365_get_sharepoint_site_details(<br>    client_id =&gt; &#39;{0}&#39;,<br>    tenant_id =&gt; &#39;{1}&#39;,<br>    sharepoint_url =&gt; &#39;{2}&#39;,<br>    sharepoint_site =&gt; &#39;{3}&#39;,<br>    sharepoint_folder =&gt; &#39;{4}&#39;)<br>    &#39;&#39;&#39;.format(*args)<br>    <br>        <br>    sharepoint_details = session.sql(sharepoint_details_query).collect()[0][0]<br>    sharepoint_details_json = json.loads(sharepoint_details)<br>    folder_id = sharepoint_details_json[&quot;folder_id&quot;]<br>    site_id = sharepoint_details_json[&quot;site_id&quot;]<br><br>    #Raise an exception if folder_id or site_id is blank<br>    if not site_id:<br>        raise Exception(&quot;Incorrect site name!&quot;)<br>    if not folder_id:<br>        raise Exception(&quot;Incorrect folder name!&quot;)<br>    <br>    resource_uri = GRAPH_URL + f&#39;/sites/{site_id}/drive/items/{folder_id}/children&#39;<br>    <br>    headers = {<br>        &#39;Authorization&#39;: &#39;Bearer &#39; + token,<br>        &#39;Accept&#39;: &#39;application/json&#39;<br>    }<br>    <br>    try:<br>        response = requests.get(resource_uri, headers=headers)<br>        if response.status_code == 200:<br>            files = response.json().get(&#39;value&#39;, [])<br>            for file in files:<br>                file_name = os.path.join(&#39;/workspace/stage/&#39;,file[&#39;name&#39;])<br>                download_url = file[&#39;@microsoft.graph.downloadUrl&#39;]<br><br>                # Download the file<br>                file_response = requests.get(download_url, headers=headers)<br>                if file_response.status_code == 200:<br>                    with open(file_name, &#39;wb&#39;) as f:<br>                        f.write(file_response.content)<br><br>            return &#39;Success!&#39; <br>        else:<br>            return &#39;Failed to Download. Please investigate &#39;<br>    except Exception as e:<br>        return f&#39;Encountered the following error: {e}&#39;</pre><p><strong>Dockerfile</strong></p><p>This is our collection of instructions and commands that will be fired when then container is spun up. Notice that it installs the necessary packages needed for our container.</p><pre>ARG BASE_IMAGE=python:3.10-slim-buster<br>FROM $BASE_IMAGE<br><br># Install FFMPEG<br>RUN export DEBIAN_FRONTEND=noninteractive \<br>    &amp;&amp; apt-get -qq update \<br>    &amp;&amp; apt-get -qq install --no-install-recommends \<br>    ffmpeg \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*<br><br>RUN pip install --upgrade pip &amp;&amp; \<br>    pip install fastapi gunicorn uvicorn[standard] Office365-REST-Python-Client numpy snowflake-snowpark-python[pandas]<br><br>WORKDIR /workspace/app<br>COPY app /workspace/app<br><br>ENTRYPOINT [&quot;gunicorn&quot;, &quot;--bind&quot;, &quot;0.0.0.0:9000&quot;, &quot;--workers&quot;, &quot;1&quot;, &quot;--timeout&quot;, &quot;0&quot;, &quot;webservice:app&quot;, &quot;-k&quot;, &quot;uvicorn.workers.UvicornWorker&quot;]</pre><p><strong>sp_svc_spec.yml</strong></p><p>This specification file provides the necessary information to configure and run our service, you can provide this detail in-line or via an internal stage when creating a service function that will use this as reference. In our case, we’ll upload it to an internal stage called app_spec.</p><pre>spec:<br>  container:<br>  - name: sp-pull-docs-svc<br>    image: &lt;image repo url&gt;/demo_db/sharepoint/app_images/sp-pull-docs-svc<br>    volumeMounts:<br>      - name: stage<br>        mountPath: /workspace/stage<br>    env:<br>      SNOW_ROLE: SYSADMIN<br>      SNOW_WAREHOUSE: POC_WH<br>      SNOW_DATABASE: DEMO_DB<br>      SNOW_SCHEMA: SHAREPOINT<br>    resources:<br>      requests:<br>        cpu: 1<br>      limits:<br>        cpu: 1<br>    secrets:<br>      - snowflakeSecret: common.utility.azure_auth<br>        secretKeyRef: secret_string<br>        envVarName: GENERIC_SECRET<br>  volume:<br>  - name: stage<br>    source: &quot;@PDF_STAGE&quot;<br>    uid: 1000<br>    gid: 1000<br>  endpoint:<br>  - name: api <br>    port: 9000<br>    public: true</pre><h4>Create snowflake objects to host container code and service specification file</h4><pre>use role sysadmin;<br>use schema demo_db.sharepoint;<br>use warehouse poc_wh;<br><br>create image repository app_images;<br>CREATE OR REPLACE STAGE pdf_stage ENCRYPTION = (TYPE = &#39;SNOWFLAKE_SSE&#39;);<br>create stage app_spec;<br><br>--Upload sp_svc_spec.yml file created above to app_spec stage.<br><br>--For obtaining the image repo url, fire this command and copy everything until<br>--snowflakecomputing.com<br><br>show image repositories;</pre><p><strong>Docker Build Commands</strong></p><p>These commands should be fired on your local laptop or dev server wherever you’re creating the container image. Image repo URL can be obtained from the ‘<em>show image repositories</em>’ command as explained above.</p><pre>#Docker login<br>Docker Login:<br>docker login &lt;Image repo URL&gt; -u &lt;user name&gt;<br><br>#Build and push docker image for sharepoint code<br>docker build --rm --platform linux/amd64 -t sp-pull-docs-svc .<br>docker tag sp-pull-docs-svc &lt;Image repo URL&gt;/demo_db/sharepoint/app_images/sp-pull-docs-svc<br>docker push &lt;Image repo URL&gt;/demo_db/sharepoint/app_images/sp-pull-docs-svc</pre><h3>Create an SPCS service and deploy a service function</h3><p>With the container code now available in a snowflake image repository we’re ready to put together our container service and a service function to fetch documents from sharepoint.</p><pre>use role accountadmin;<br>CREATE COMPUTE POOL IF NOT EXISTS SHAREPOINT_DOCS_CP<br>    MIN_NODES = 1<br>    MAX_NODES = 1<br>    INSTANCE_FAMILY = CPU_X64_S<br>    AUTO_RESUME = true<br>    AUTO_SUSPEND_SECS = 600;<br><br>grant usage on compute pool SHAREPOINT_DOCS_CP to role sysadmin;<br>grant bind service endpoint on account to role sysadmin;<br><br><br>--Swtich back to sysadmin <br>use role sysadmin;<br>use schema demo_db.sharepoint;<br>use warehouse poc_wh;<br><br>--Ensure that image has been pushed to snowflake&#39;s image repository app_images<br>show images in image repository app_images;<br><br>--Sharepoint service<br>CREATE SERVICE SHAREPOINT_DOCS_SVC<br>  IN COMPUTE POOL SHAREPOINT_DOCS_CP <br>  FROM @APP_SPEC<br>  SPEC=&#39;sp_svc_spec.yml&#39;<br>  MIN_INSTANCES=1<br>  MAX_INSTANCES=1<br>  EXTERNAL_ACCESS_INTEGRATIONS = (SP_PIP_ACCESS);<br><br>CREATE OR REPLACE FUNCTION get_sp_files(client_id TEXT, tenant_id TEXT, sharepoint_url TEXT, sharepoint_site TEXT, sharepoint_folder TEXT)<br>RETURNS variant<br>SERVICE=SHAREPOINT_DOCS_SVC<br>ENDPOINT=API<br>AS &#39;/download-docs&#39;;<br><br>--Ensure that the service is up and running and ready to use.<br>call system$get_service_status(&#39;SHAREPOINT_DOCS_SVC&#39;);<br><br>--For any errors, detailed logs can be examined with this command.<br>CALL SYSTEM$GET_SERVICE_LOGS(&#39;DEMO_DB.SHAREPOINT.SHAREPOINT_DOCS_SVC&#39;, &#39;0&#39;, &#39;sp-pull-docs-svc&#39;,100);<br><br>--Proceed once the service is in READY state</pre><h4>Moment of truth</h4><p>If you’ve reached till this point, now is the time to bear the fruit of your labour. Let’s call our service function</p><pre>select get_sp_files(<br>    client_id =&gt; &#39;&lt;client_id&gt;&#39;,<br>    tenant_id =&gt; &#39;&lt;tenant_id&gt;&#39;,<br>    sharepoint_url =&gt; &#39;&lt;sharepoint_url&gt;&#39;,<br>    sharepoint_site =&gt; &#39;&lt;sharepoint_site&gt;&#39;,<br>    sharepoint_folder =&gt; &#39;&lt;sharepoint_folder&gt;&#39;);</pre><p>If everything runs ok, you will see a success message returned and all files or documents available in the internal stage pdf_stage that we’ve mounted as a volume mount with our container.</p><h4>Cleanup</h4><p>Don’t forget to cleanup resources that you’ve created for the demo, at a minimum drop or suspend the compute pool</p><pre>use role accountadmin;<br>alter compute pool SHAREPOINT_DOCS_CP suspend;`<br>--Wait for a minute or two and ensure compute pool is in suspended state.<br>show compute pools;</pre><h3>Screengrab for sharepoint and MS entra values needed</h3><p>If you’re having trouble obtaining necessary information needed in order to make these graph API calls, we’ve provided screengrabs from our test environment below.</p><p><strong>Client ID</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wkysRzl8Kvj34IVEZc45g.png" /></figure><p><strong>Tenant ID</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWUKMa3OcT1p2lkeRiJeJA.png" /></figure><p><strong>Client Secret</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GJLSw18GP9iXvFsDCn28YQ.png" /><figcaption>Client Secret — this is only visible at the time of creation. We’ll store and access this secret via Snowflake’s newly launched secrets object.</figcaption></figure><p><strong>Microsoft graph API permissions for service principal</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBzzFvROhabF2SGWz9fU2Q.png" /></figure><p><strong>Sharepoint URL and Site</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*niraz46X0fqAVPVnJ3TX0w.png" /><figcaption>Sharepoint URL and Sharepoint site will be needed for authenticating via Graph API in snowpark container services</figcaption></figure><p><strong>Sharepoint Folder</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YoNgdWvXvuKQFLesQRIudA.png" /><figcaption>Folder to get the documents from</figcaption></figure><h3>Conclusion</h3><p>Snowflake has come a long way in providing native support for unstructured data and snowpark allows us to leverage python’s rich open source ecosystem to easily operate on this unstructured data. It should be noted though that it is not always possible to move a heavy repository of documents from it’s historic resting place such as sharepoint. If these documents are available on cloud storage or on s3-compatible storage, you can still process them natively in snowflake with the help of a storage integration object. But if you’re able to move them to Snowflake — you now have a single repository for your structured and unstructured data that can power a host of downstream data applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b97a423d71db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/syncing-documents-from-sharepoint-to-snowflake-by-leveraging-microsoft-graph-apis-in-snowpark-b97a423d71db">Sync documents from sharepoint to snowflake with Microsoft Graph APIs and snowpark container…</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Governed Data Collaboration In Snowflake]]></title>
            <link>https://medium.com/snowflake/governed-data-collaboration-in-snowflake-4e4b0ab59fbf?source=rss-5702f8cda39d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e4b0ab59fbf</guid>
            <category><![CDATA[data-clean-room]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[data-collaboration]]></category>
            <category><![CDATA[data-privacy]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Prateek Parashar]]></dc:creator>
            <pubDate>Thu, 13 Jul 2023 16:02:22 GMT</pubDate>
            <atom:updated>2024-07-26T13:54:59.397Z</atom:updated>
            <content:encoded><![CDATA[<h4>Enabling governance for shared data assets</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L95Babwe3jGaD3p3KZQRVw.png" /></figure><p><em>Snowflake, over the years, has rolled out a fleet of governance features in order to provide customers a seamless, hands-off approach to governance. In this article we will explore how some of these more extensively used governance features such as dynamic data masking policy and row access policy apply themselves in a collaboration scenario. We will also learn about the exciting new addition to this fleet — projection policy (or projection constraints) which when applied to a column will prevent it from direct sql projection.</em></p><p><em>Disclaimer: This article talks about projection constraints which is a private preview feature and may not be available in your account by default. Talk to your snowflake account team for getting access.</em></p><p><em>Edit Jul 26th, 2024 — Projection Policies are now GA and should be available to all accounts that are enterprise edition and above.</em></p><h3>Overview</h3><p>Fast, streamlined access to relevant data is key to successful business outcomes. However, many organizations struggle to share data — internally between teams and externally with partners, vendors, and customers. Data collaboration (aka data sharing) has the power to improve the quality of analytics programs and even create new product offerings.</p><p>An important aspect of data collaboration is governance — often, data providers are cautious about sharing data because they’re unsure of how it will be leveraged by the consumer or are worried about potential misuse.</p><p>A data clean room solves this problem but its implementation can seem daunting without relying on a service integrator or partner product. In this article we’ll cover some native options to ensure that a provider, to some degree, is able to guard against data misuse by securing sensitive columns and rows while simultaneously ensuring that the consumer can continue to run analytics on the shared dataset.</p><p>Consider a data enrichment use case. Party A and Party B have access to certain non-overlapping customer attributes and Party A has agreed to share it’s attributes with Party B such that it can blend the two datasets together and present a complete picture of the customer. Once the blending is successfully achieved, Party B can optionally share enriched dataset back with Party A for both parties to benefit from the this exercise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AKV7PwtxolzbxTy_d5ywbg.png" /><figcaption>Party A (Provider) shares customer attributes that it has with Party B (Consumer)</figcaption></figure><p>Party B decided to create a streamlit visualization to display the blended dataset</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew8WjPx3O7pE5hcdFSJqbw.png" /><figcaption>Streamlit app created from the blended dataset</figcaption></figure><p>This visualization is powered by the query below which joins the two datasets together on SSN, sensitive information that party A intends to protect later on in the article but is currently shared in the clear.</p><p>The join condition is the underpinning on which the streamlit app stands and must continue to work for the consumer to be able to enrich it’s customer data. Therefore, any attempts to hash/encrypt the SSN must be join preserving.</p><pre>--This is the query powering out streamlit viz<br>select a.first_name,<br>       a.last_name,<br>       a.ssn,<br>       --b.ssn,<br>       a.gender,<br>       a.birthday,<br>       a.iban,<br>       a.cc,<br>       a.ccexp,<br>       a.card_type,<br>       a.credit_score,<br>       b.occupation,<br>       zeroifnull(b.salary) as salary,<br>       b.education,<br>       b.email, <br>       b.street, <br>       b.city, <br>       b.state, <br>       b.postcode <br>       from customers.noam_northeast.consumer_customers a left join <br>shared_customers.noam_northeast.provider_customers b on a.ssn = b.ssn;</pre><h3>Securing sensitive data in the provider’s dataset</h3><p>Party A has certain new rules issued by it’s governance team which requires all teams sharing data out with another snowflake customer must ensure:</p><ul><li>Email address is at least partially masked such that only the domain name is visible.</li><li>You cannot share data of customers belonging to the state of Illinois.</li><li>Restrict third-party accounts from projecting direct identifiers, like SSN, in the shared dataset as output of SQL queries.</li></ul><h4>Email Address</h4><p>In order to partially mask the email column the provider decides to create a dynamic data masking (DDM) policy that they will apply on this column in the dataset that they intend to share. DDM, in snowflake, is a column-level security feature that is used to selectively mask plain text data in tables or views at query time.</p><p>Key distinction in how a DDM is <em>typically</em> employed vs how it is used here is in the context functions used in the policy definition. E.g. a multi-tenant snowflake environment supporting different business units, would have roles defined to draw data access boundaries and a dynamic data masking policy can leverage these roles/personas to further restrict access to sensitive data by relying on context functions like <strong>current_user() </strong>and<strong> current_role()</strong>. But in a data sharing scenario, using these context functions have no relevance as those same roles/personas will most likely not exist in the consumer’s account and even if they do, a provider has no control over user/role management in a consumer’s account. What we want to work with instead is a context function that is able to restrict access at an account level, i.e. <strong>current_account()</strong></p><p>Let’s see this in action, the provider decides to create the below masking policy such that every time the email column is accessed from a said account, it will see a partially masked version of the email address.</p><pre><br>--Provider decides to secure Email address with dynamic masking policy<br>create masking policy common.utility.mask_email as (email string) returns string -&gt;<br>    case<br>        --invoker_share()<br>        when current_account() = &#39;&lt;consumer_account_name&gt;&#39; then regexp_replace(email,&#39;.+\@&#39;,&#39;*****@&#39;)<br>        else email<br>    end;<br><br>--Apply masking policy<br>alter view customers.noam_northeast.provider_customers <br>    modify column email <br>    set masking policy common.utility.mask_email;</pre><p>A key benefit of live data sharing is that any change to data <em>or</em> data access will be visible to the consumer immediately. After applying the above masking policy, the consumer instantly loses access to clear-text email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUSgxIPDrTw9jHn1N-xCuA.png" /><figcaption>Consumer’s streamlit dashboard shows partially masked email address</figcaption></figure><h4>Restrict access to customers from IL</h4><p>Shifting from column-level security to row-level security, our next requirement needs us to revoke full row access to data belonging to customers from the state of Illinois from third party accounts.</p><p>We will use a row-access policy to achieve this, context function in the policy would again be <strong>current_account() </strong>for the reasons we discussed above.</p><pre>--Due to state laws, the provider cannot share data of anybody who is a resident of Illinois.<br>create or replace row access policy common.utility.redact_il_residents as (state varchar(10)) returns boolean -&gt;<br>    case<br>        when current_account() = &#39;&lt;consumer_account_name&gt;&#39; and state = &#39;IL&#39; then false<br>        else true<br>    end;<br><br>--Apply RLS to the view that is being shared<br>alter view customers.noam_northeast.provider_customers<br>    add row access policy common.utility.redact_il_residents on (state);</pre><p>As soon as the provider applies this policy, the consumer would lose access to attributes availed from the providers shared dataset for customers belonging to the state of IL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k0a18T6KptmKVDnA-IySBQ.png" /><figcaption>Provider attributes for customers from the state of IL are not available to</figcaption></figure><p>Attributes for customers from other states should continue to be visible without change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6njF8sYQaBoP3xYU5RYTg.png" /><figcaption>Provider attributes for customers from other states still visible</figcaption></figure><h4>Secure direct identifiers, like SSN</h4><p>The third requirement for this article is to secure the SSN column. This is where it gets a little interesting, the SSN column is consumer’s ticket to insight. It is what the consumer uses to join the provider’s dataset with it’s own to come up with a holistic customer view.</p><p>Any attempt to conceal SSN should be carefully treaded, as masking the key column could result in consumer effectively losing access to all of provider’s customer attributes.</p><p>Let’s explore what would happen if we simply mask the SSN with ‘******’. Masking policy below would achieve this for us.</p><pre>--This seems to work well, governance team further identifies that a more sensitive direct identifier - SSN is also exposed <br>--to the consumer in the clear. Can we apply the same solution? The consumer joins their own dataset on this column to detect<br>--customer overlap and study different customer attributes (qualification &amp; contact info) that are available in the provider data.<br>create masking policy common.utility.mask_ssn as (ssn string) returns string -&gt;<br>    case<br>        when current_account() = &#39;&lt;consumer_account_name&gt;&#39; then &#39;******&#39;<br>        else ssn<br>    end;<br><br>--Apply masking policy to secure SSN<br>alter view customers.noam_northeast.provider_customers<br>    modify column ssn<br>    set masking policy common.utility.mask_ssn;</pre><p>Because the provider has masked it’s key column with asterisk, the join condition that was blending datasets from both parties would fail and the consumer would see no customer attributes that the provider had, effectively disabling data collaboration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nAfsSPwiY3M6MJiyjGdZoQ.png" /><figcaption>Key columns should not be masked</figcaption></figure><p>Below is the SQL query result when the consumer directly queries the provider’s dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FaXd9rvcKnxAevt7Y3gWvw.png" /></figure><h3><em>Introducing</em> projection constraints</h3><p>The latest addition to snowflake’s family of policies is <strong>projection policy</strong> which will help us tackle this use case more effectively.</p><p>A projection policy, like other policies, is a first class, schema-level object that defines whether a column can be projected in the output of the sql query. A column on which a projection policy is applied will be <em>projection</em> <em>constrained </em>and any attempt to select this column will fail.</p><p>A projection constrained column:</p><ul><li>Cannot be included in the output of a query result.</li><li>Cannot be inserted into another table.</li><li>Cannot be passed as argument to an external function or stored proc.</li></ul><p>For our purpose, these protections are sufficient for the SSN column. The consumer can match on sensitive data but cannot project or enumerate records.</p><p>Below is how we would create the projection policy and apply it on the SSN column.</p><pre>--Let&#39;s try applying projection policy instead<br>create or replace projection policy common.utility.secure_ssn<br>as () returns projection_constraint -&gt;<br>    case<br>        when current_account() = &#39;&lt;consumer_account_name&#39;<br>            then projection_constraint(allow =&gt; false)<br>        else projection_constraint(allow =&gt; true)<br>    end;<br><br>--Apply projection policy on the SSN column<br>alter view customers.noam_northeast.provider_customers <br>    modify column ssn<br>    set projection policy common.utility.secure_ssn;</pre><p>Once again, thanks to the functioning of live data shares, as soon as the provider protects SSN with a projection policy, the consumer will be instantaneously disallowed from projecting this column</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsI5Vw1cNMoknz_0m9vRFA.png" /><figcaption>Projection policy throws an error when you try to select a constrained column</figcaption></figure><p>But you can project other columns in the output and use the column concealed by projection policy in a join.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYsI9ALFSHRn1V0utCUvQQ.png" /><figcaption>Other columns in the shared dataset can be selected but are now anonymized</figcaption></figure><p>Here’s the output of the query that is powering our streamlit visualization</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XjKs_d6aWBGb4xO5P36VZw.png" /></figure><p>And sure enough, our customer 360 view is back to life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztM8ejewo9mHu0xUS0YfNg.png" /></figure><h3>Conclusion</h3><p>Snowflake’s direct data share capability offers a simple and effective way to collaborate with other parties on data. Native governance capabilities like masking policies, row access policies and now projection policies offer additional knobs to data providers to ensure their data assets are shared outside the org in a governed and secure way.</p><p>In the example we discussed in this article, hashing or encryption could also potentially be used but both would require some upfront planning around compute cycles, hash functions to use, collision avoidance etc.</p><p>When you’re wanting to share data with a consumer and the goal is to conceal information in a way that is easy, extensible and would not rob data of it’s analytical value. Snowflake’s rich collection of governance policies provide just that.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e4b0ab59fbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snowflake/governed-data-collaboration-in-snowflake-4e4b0ab59fbf">Governed Data Collaboration In Snowflake</a> was originally published in <a href="https://medium.com/snowflake">Snowflake Builders Blog: Data Engineers, App Developers, AI, &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>