This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- pii_name_tag | |
CREATE OR REPLACE TAG frostbyte_tasty_bytes.raw_customer.pii_name_tag | |
ALLOWED_VALUES 'First Name', 'Last Name' | |
COMMENT = 'PII Tag for Name Columns' | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CALL ASSOCIATE_SEMANTIC_CATEGORY_TAGS( | |
'customer_loyalty', | |
EXTRACT_SEMANTIC_CATEGORIES('customer_loyalty') | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select f.key::varchar as column_name | |
, f.value:"privacy_category"::varchar as privacy_category | |
, f.value:"semantic_category"::varchar as semantic_category | |
, f.value:"extra_info":"probability"::number(10,2) as probability | |
, f.value:"extra_info":"alternates"::variant as alternates | |
from table(FLATTEN(EXTRACT_SEMANTIC_CATEGORIES('customer_loyalty')::VARIANT)) AS f | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"BIRTHDAY_DATE": { | |
"extra_info": { | |
"alternates": [], | |
"probability": "1.00" | |
}, | |
"privacy_category": "QUASI_IDENTIFIER", | |
"semantic_category": "DATE_OF_BIRTH" | |
... | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select EXTRACT_SEMANTIC_CATEGORIES('customer_loyalty') as esc_customer_loyalty | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM information_schema.packages | |
WHERE language = 'python' | |
AND package_name in ('faker', 'pandas') | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT distinct package_name | |
FROM information_schema.packages | |
WHERE language = 'python' | |
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Where clause for the Fully Qualified Table Name | |
wc_full_qual_table_name = database_name + '.' + schema_name + '.' + table_name | |
sql_quality_metrics = f"""SELECT * | |
FROM QUALITY_ASSURANCE.QUALITY_CHECK.DATA_QUALITY_METRICS | |
WHERE FULL_QUAL_TABLE_NAME = '{wc_full_qual_table_name}' | |
; """ | |
st.write("Data Quality Metrics for table: " + table_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call Snowflake Procedure when button is clicked | |
if st.sidebar.button('Run Quality Assurance'): | |
cursor = ctx.cursor() | |
cursor.execute(f"CALL QUALITY_ASSURANCE.QUALITY_CHECK.DATA_QUALITY('{database_name}', '{schema_name}', '{table_name}')") | |
st.sidebar.success('Procedure has been executed successfully.') | |
cursor.close() |