Skip to content

Release 14a1b61c295805865f59

Compare
Choose a tag to compare

Published S3 Paths

  • Latest UDFs
    • s3://whylabs-snowflake-udfs/udfs/v1/latest/setup.sql
    • s3://whylabs-snowflake-udfs/udfs/v1/latest/whylogs_udf.py
    • s3://whylabs-snowflake-udfs/udfs/v1/latest/whylabs_upload_udf.py
  • Version tagged UDFs
    • s3://whylabs-snowflake-udfs/udfs/v1/archive/14a1b61c295805865f59/setup.sql
    • s3://whylabs-snowflake-udfs/udfs/v1/archive/14a1b61c295805865f59/whylogs_udf.py
    • s3://whylabs-snowflake-udfs/udfs/v1/archive/14a1b61c295805865f59/whylabs_upload_udf.py

Published HTTP paths

  • Latest UDFs
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/latest/setup.sql
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/latest/whylogs_udf.py
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/latest/whylabs_upload_udf.py
  • Version tagged UDFs
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/archive/14a1b61c295805865f59/setup.sql
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/archive/14a1b61c295805865f59/whylogs_udf.py
    • https://whylabs-snowflake-udfs.s3.us-west-2.amazonaws.com/udfs/v1/archive/14a1b61c295805865f59/whylabs_upload_udf.py

Snowflake SQL

Create the latest functions in Snowflake like so. Make sure to see
the official doc page for all
of the instructions. This snippet doesn't cover creating the
required secrets and secret configuration.

CREATE OR REPLACE NETWORK RULE whylabs_profiling_rule
  MODE = EGRESS
  TYPE = HOST_PORT
  VALUE_LIST = ();

CREATE OR REPLACE NETWORK RULE whylabs_api_network_rule
  MODE = EGRESS
  TYPE = HOST_PORT
  VALUE_LIST = ('api.whylabsapp.com', 'log.whylabsapp.com', 'songbird-20201223060057342600000001.s3.us-west-2.amazonaws.com');
CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION whylabs_integration
  ALLOWED_NETWORK_RULES = (whylabs_profiling_rule)
  ALLOWED_AUTHENTICATION_SECRETS = (segment_columns, data_grouper_freq)
  ENABLED = true;

CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION whylabs_upload_integration
  ALLOWED_NETWORK_RULES = (whylabs_api_network_rule)
  ALLOWED_AUTHENTICATION_SECRETS = (whylabs_api_key, whylabs_org_id, whylabs_dataset_id)
  ENABLED = true;

CREATE OR REPLACE STORAGE INTEGRATION whylabs_s3_integration
  TYPE = EXTERNAL_STAGE
  STORAGE_PROVIDER = 'S3'
  ENABLED = TRUE
  STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::207285235248:role/public-snowflake-role'
  STORAGE_ALLOWED_LOCATIONS = ('s3://whylabs-snowflake-udfs/udfs/')
;


CREATE OR REPLACE STAGE whylabs_udf_stage
  STORAGE_INTEGRATION = whylabs_s3_integration
  URL = 's3://whylabs-snowflake-udfs/udfs/'
;
create or replace function whylogs(data object)
    returns table (
        profile_view varchar,
        dataset_timestamp int,
        segment_partition varchar,
        segment varchar,
        rows_processed int,
        debug_info varchar
    )
    language python
    runtime_version = '3.10'
    external_access_integrations = (whylabs_integration)
    secrets = ('data_grouper_freq' = data_grouper_freq, 'segment_columns' = segment_columns)
    packages = ('snowflake-snowpark-python', 'whylogs', 'pandas')
    handler = 'whylogs_udf.handler'
    imports = ('@whylabs_udf_stage/v1/latest/whylogs_udf.py')
    ;


create or replace function whylabs_upload(profile_view varchar, segment_partition varchar, segment varchar)
    returns table (upload_result varchar)
    language python
    runtime_version = '3.10'
    external_access_integrations = (whylabs_upload_integration)
    secrets = ('whylabs_api_key' = whylabs_api_key, 'whylabs_org_id' = whylabs_org_id, 'whylabs_dataset_id' = whylabs_dataset_id)
    packages = ('snowflake-snowpark-python', 'requests', 'whylogs', 'whylabs-client')
    handler = 'whylabs_upload_udf.handler'
    imports = ('@whylabs_udf_stage/v1/latest/whylabs_upload_udf.py')
;