Search code examples
javaapisnowflake-cloud-data-platformmasking

Dynamic masking from a Java program


I am new to Snowflake. I am trying to understand if it is possible to set (and unset) dynamic masking on a specific column for certain roles from a java program and not using Snowflake web UI. Is there an API to do this task? Thanks Yoram


Solution

  • You can set/unset a masking policy by executing an ALTER TABLE-statement.

    Example from docs: alter table empl_info modify column empl_id unset masking policy;

    More infos: https://docs.snowflake.com/en/sql-reference/sql/alter-table-column.html

    Regarding sending this statement from Java applications, you have to use the JDBC driver and its corresponding API: https://docs.snowflake.com/en/user-guide/jdbc-api.html