Uninstalling Snowflake Data Clean Rooms

This topic describes the tasks an administrator must complete to uninstall Snowflake Data Clean Rooms.

Important

This procedure completely uninstalls the entire environment, not just individual clean rooms.

To uninstall, execute the following steps:

  1. Delete all clean rooms that you created as a provider. This includes both web app and developer API clean rooms.

  2. Use the web app to find the tiles associated with clean rooms that you joined as a consumer, then leave the clean rooms.

  3. Use the consumer.uninstall_cleanroom command to uninstall developer API clean rooms that you installed as a consumer.

  4. Contact your Snowflake representative to retrieve your account metadata.

  5. When instructed, run the following cleanup script:

Note

Make sure to leave clean rooms (consumer side) and delete clean rooms (provider side) in the web app prior to running this script. The consumer databases are dropped automatically by the application drop (final step). Run all SELECT statements very carefully.

USE ROLE ACCOUNTADMIN;
USE WAREHOUSE APP_WH;

-- Drop listings

SHOW LISTINGS;
SELECT concat('alter listing ', "name", ' unpublish; drop listing ', "name", ';') FROM TABLE(result_scan(last_query_id()));

-- Drop shares

SHOW SHARES;
SELECT concat('drop share ', "name", ';') FROM TABLE(result_scan(last_query_id())) WHERE "kind" = 'OUTBOUND';

-- These 3 shares have to be dropped manually:

DROP SHARE SAMOOHA_INTERNAL_GOVERNANCE_SUMMARY_SHARE_NAV2;
DROP SHARE SAMOOHA_INTERNAL_LOGS_SHARE_NAV2;
DROP SHARE SAMOOHA_INTERNAL_PROVIDER_METADATA_NAV2;

-- Drop applications

SHOW APPLICATIONS;
SELECT concat('drop application ', "name", ' cascade;') FROM TABLE(result_scan(last_query_id())) WHERE "name" LIKE 'SAMOOHA_CLEANROOM_APP_%';

-- Drop application packages

SHOW APPLICATION PACKAGES;
SELECT concat('drop application package ', "name", ' cascade;') FROM TABLE(result_scan(last_query_id())) WHERE "name" LIKE 'SAMOOHA_CLEANROOM_%';

-- Drop databases

SHOW DATABASES;
SELECT concat('drop database ', "name", ';') FROM TABLE(result_scan(last_query_id())) WHERE "name" LIKE 'SAMOOHA_CLEANROOM_%' OR "name" = 'SAMOOHA_BY_SNOWFLAKE_LOCAL_DB' OR "name" LIKE 'SAMOOHA_INTERNAL_GOVERNANCE_%' AND NOT startswith("name", 'SAMOOHA_CLEANROOM_CONSUMER_');

-- Finally drop the Snowflake native app

DROP APPLICATION SAMOOHA_BY_SNOWFLAKE CASCADE;
Copy