To facilitate efficient data analysis and performance optimization, it is necessary to set up metadata sharing between your Snowflake account and Yuki’s Snowflake account. This guide details the steps required to configure this data sharing, ensuring Yuki can access query history and warehouse metering history without compromising data security.
Understanding Snowflake Data Sharing
Snowflake’s data sharing technology allows you to share data securely across Snowflake accounts without copying or moving data. This secure and governed method ensures that data remains within Snowflake’s managed environment, preserving the original format and encryption.
Data sharing is real-time, meaning changes made to the shared data are immediately available to the recipient. You maintain full control over the shared data, with the ability to revoke access at any time, ensuring compliance and security.
For more details on Snowflake Data Sharing, refer to the .
Process of Sharing Data
The following steps outline how to create and configure the database and share for metadata exchange with Yuki:
DROP SHARE IF EXISTS share_queries_with_yuki;
CREATE OR REPLACE DATABASE yuki_data;
GRANT OWNERSHIP ON DATABASE yuki_data TO ROLE yuki_application_role;
GRANT OWNERSHIP ON SCHEMA yuki_data.public TO ROLE yuki_application_role;
CREATE SHARE share_queries_with_yuki;
GRANT USAGE ON DATABASE yuki_data TO SHARE share_queries_with_yuki;
GRANT USAGE ON SCHEMA yuki_data.public TO SHARE share_queries_with_yuki;
-- Create query history table
CREATE OR REPLACE TABLE yuki_data.public.query_history (query_id string, end_time timestamp_ltz);
GRANT OWNERSHIP ON TABLE yuki_data.public.query_history TO ROLE yuki_application_role;
-- Create query attribution history table
CREATE OR REPLACE TABLE yuki_data.public.query_attribution_history (query_id string, end_time timestamp_ltz);
GRANT OWNERSHIP ON TABLE yuki_data.public.query_attribution_history TO ROLE yuki_application_role;
-- Create sessions table
CREATE OR REPLACE TABLE yuki_data.public.sessions (session_id string, created_on timestamp_ltz);
GRANT OWNERSHIP ON TABLE yuki_data.public.sessions TO ROLE yuki_application_role;
-- Create warehouse metering history table
CREATE OR REPLACE TABLE yuki_data.public.warehouse_metering_history (warehouse_id int, end_time timestamp_ltz);
GRANT OWNERSHIP ON TABLE yuki_data.public.warehouse_metering_history TO ROLE yuki_application_role;
-- Grant permissions for the created tables to yuki SHARE
GRANT SELECT ON TABLE yuki_data.public.query_history TO SHARE share_queries_with_yuki;
GRANT SELECT ON TABLE yuki_data.public.query_attribution_history TO SHARE share_queries_with_yuki;
GRANT SELECT ON TABLE yuki_data.public.sessions TO SHARE share_queries_with_yuki;
GRANT SELECT ON TABLE yuki_data.public.warehouse_metering_history TO SHARE share_queries_with_yuki;
-- Add external account to the share
ALTER SHARE share_queries_with_yuki ADD ACCOUNTS = xxx.xxx; --Replace with Yuki's Snowflake account identifier
By completing the steps above, you will establish a secure and efficient channel for Yuki to access necessary metadata, enabling enhanced performance analytics and optimizations within your Snowflake environment.