top of page

Installation guide: UnionAll Data Discovery Snowflake AppGetting started!

Writer's picture: Pedram BirounvandPedram Birounvand

Shortlist of things to get started (TLDR)

  1. Download the Snowflake Native App

  2. Fetch your API-key from UnionAll

  3. Create an external function in Snowflake

  4. When prompted specify the function in the app

Download the Snowflake App!

💡 You currently have to have a snowflake account with AWS as cloud provider in a non gov- region.

  • Login to your snowflake account

  • Install the app

Fetch your API key:

  • Go to UnionAll > Login with Google or Microsoft.

  • Press on your profile in the top right corner

  • Press "Get API key" to generate the key

💡 Make sure you save the API-key in a secure location


Create a function and integration in snowflake

Copy the following code into a snowflake worksheet

//Choose schema and database:
use schema <database>.<schema>;

// Store your API key:
CREATE SECRET UNIONALL_API_KEY
    TYPE = GENERIC_STRING
    SECRET_STRING = '<your-api-key>';

// Create network rule:
CREATE NETWORK RULE UNIONALL_API_NETWORK_RULE
    MODE = EGRESS
    TYPE = HOST_PORT
    VALUE_LIST = ('snowflake-gateway.cloud.unionall.ai');

// Create external access integration (Allows external access):
CREATE EXTERNAL ACCESS INTEGRATION UNIONALL_EXTERNAL_INTEGRATION
    ALLOWED_NETWORK_RULES = (UNIONALL_API_NETWORK_RULE)
    ALLOWED_AUTHENTICATION_SECRETS = (UNIONALL_API_KEY)
    ENABLED = true;

// Create query-function (wrapper function for calling the api)
CREATE SECURE FUNCTION UNIONALL_DATAPRODUCTS(query varchar)
    RETURNS STRING
    LANGUAGE PYTHON
    RUNTIME_VERSION = 3.9
    HANDLER = 'call_function'
    EXTERNAL_ACCESS_INTEGRATIONS = (UNIONALL_EXTERNAL_INTEGRATION)
    SECRETS = ('unionall_key' = UNIONALL_API_KEY)
    PACKAGES = ('requests','urllib3')
    AS
$$
import _snowflake
import json
import requests
from urllib.parse import urlencode
def call_function(QUERY):
    my_api_key = _snowflake.get_generic_secret_string('unionall_key')
    request_url = "<https://snowflake-gateway.cloud.unionall.ai/v1/snowflake/query>"
    n_results = 4
    headers = {
        "accept": "application/json",
        "Content-Type": "application/json",
        "X-API-Key": f"{my_api_key}",
    }
    req = requests.get(request_url + "?" + urlencode({"query":QUERY, "n_results": n_results}),headers=headers)
    return req.text
$$;

select UNIONALL_DATAPRODUCTS('I am looking for a dataset') as response;
  • Change the <database>.<schema> to your preferred location and replace <your-api-key> with your API-key key.

  • Execute the SQL in your worksheet!

  • You can test the api in your snowflake environment by running the following query in a worksheet select CALL_UNIONALL_API('Some search query')

💡 Make sure to note where you saved the function (you will be prompted to select it once you start the app)


Start the Snowflake app

  • When prompted choose your newly created function as a reference!

Comments


Stay infomed about what's new in the data business.

Sign up to our newsletter for expert insights and the latest updates in the data industry.

Address

Strandbergsgatan 61
112 51 Stockholm

Email

Follow us on

  • LinkedIn

UnionAll AB  Stockholm • 2025

bottom of page