### User Configuration Example Source: https://docs.snowddl.com/basic/yaml-configs/user Examples of user configurations in YAML format, demonstrating different user types and their properties. ```APIDOC ## User Configuration Examples ### Example 1: Standard User ```yaml DAMIAN_EDwards: password: "password" first_name: "Damian" last_name: "Edwards" email: "damian.edwards@example.com" session_params: query_tag: "Queries from Damian" error_on_nondeterministic_merge: true statement_timeout_in_seconds: 900 business_roles: - sakila_analyst comment: "Analyst with read access to Sakila data and full access to sandbox schema" ``` ### Example 2: Service User with RSA Key ```yaml etl_script: rsa_public_key: >- MIIBIjANBgkqhkiG1a0BAQEFAAOCAQ8AMIIBCgKCAQEAx4INStnNQshPamlDe5te +sF/J3zbY9BCMgcl/B11NndFRuXZjKBAyVJyJdjm2XpHGyJZrpIf1kBVJbfxpNSi qN/VLMm1nsqtEnLJsvHWT4AyJ8GG1ahYY34ody9SjLTCisSRpjzh7ZLajbyNtwbH ukOCAhy1R7RzyEmuqz3rRmnx0MUb+1wdSYfMAnVwxT11otmClhXVe3Hj9hdNmljk pw2rezWlKyeywkDpvh00/tuIFdCJD2gWcb3rAUC3e9iR6RJ4o/LFIEBlyktUPOqF d4A3+Wp/pkTiYUh2GvjHTZrGViZXBPRjciP+6ktLMuXP4bW2DeS1xEYIUeYhxaNI IwIDAQAB business_roles: - etl_script ``` ``` -------------------------------- ### Define YAML placeholders Source: https://docs.snowddl.com/basic/yaml-configs/placeholder Example configuration file demonstrating the syntax for defining placeholders. ```yaml wh_size: SMALL wh_auto_suspend: 300 bucket_name: dev-test-bucket ``` -------------------------------- ### Iceberg Table Configuration Examples Source: https://docs.snowddl.com/basic/yaml-configs/iceberg-table Examples showing different ways to define an Iceberg table using metadata paths or catalog names. ```yaml metadata_file_path: test_iceberg_table_1/metadata/00001-cc112050-1448-4c2a-9e03-504e7f5fc62a.metadata.json replace_invalid_characters: true ``` ```yaml catalog_table_name: test_iceberg_table_1 comment: abc ``` -------------------------------- ### Install SnowDDL Source: https://docs.snowddl.com/getting-started Install the SnowDDL package using pip. ```bash pip install snowddl ``` -------------------------------- ### Define database parameters in YAML Source: https://docs.snowddl.com/basic/yaml-configs/database Example configuration for a transient database with a 60-day retention period. ```yaml is_transient: true retention_time: 60 comment: "Test database" ``` -------------------------------- ### Dynamic Table YAML Configuration Source: https://docs.snowddl.com/basic/yaml-configs/dynamic-table Example configuration for a dynamic table, including the SQL query, target lag, and warehouse assignment. ```yaml text: |- SELECT timezone , count(*) AS cnt FROM ${{ env_prefix }}snowddl_db.bookings.airports_data GROUP BY 1 target_lag: 1 hour warehouse: test_wh comment: Number of airports by timezone ``` -------------------------------- ### User Configuration Example Source: https://docs.snowddl.com/basic/yaml-configs/user Defines a user with personal details, session parameters, and business roles. Password is stored in plain text and can be encrypted. ```yaml damian_edwards: password: "password" first_name: "Damian" last_name: "Edwards" email: "damian.edwards@example.com" session_params: query_tag: "Queries from Damian" error_on_nondeterministic_merge: true statement_timeout_in_seconds: 900 business_roles: - sakila_analyst comment: "Analyst with read access to Sakila data and full access to sandbox schema" ``` -------------------------------- ### Define a Snowflake View in YAML Source: https://docs.snowddl.com/basic/yaml-configs/view Example configuration for a view including column comments, the SQL definition, and a general object comment. ```yaml columns: aircraft_code: "Aircraft code, IATA" model: "Aircraft model" range: "Maximal flying distance, km" text: |- SELECT ml.aircraft_code, lang(ml.model) AS model, ml.range FROM aircrafts_data ml comment: >- Each aircraft model is identified by its three-digit code (aircraft_code). The view also includes the name of the aircraft model (model) and the maximal flying distance, in kilometers (range). ``` -------------------------------- ### Define Business Roles in YAML Source: https://docs.snowddl.com/basic/yaml-configs/business-role Example configuration for business roles, specifying schema access and warehouse usage. ```yaml bookings_analyst: schema_read: - snowddl_db.bookings warehouse_usage: - bookings_analyst_wh comment: "Business analyst working on data in Bookings schema" sakila_analyst: schema_read: - snowddl_db.sakila schema_owner: - snowddl_db.sakila_sandbox warehouse_usage: - sakila_analyst_wh comment: "Business analyst working on data in Sakila schema" ``` -------------------------------- ### SQL Query with Placeholders Source: https://docs.snowddl.com/advanced/query-builder-and-formatter Example of a SQL query utilizing various placeholder types for dynamic value injection. ```sql SELECT {common_val} AS common_val , {null_val} AS {col_name:i} , u.user_id , sum(gross_amt) AS gross_amt FROM {table_name:i} u WHERE u.user_rating >= {user_rating:d} AND u.user_score > {user_score:f} AND u.is_female IS {is_female:b} AND u.status IN ({user_statuses}) AND u.user_rating NOT IN ({exclude_user_score:d}) GROUP BY 1,2,3 ORDER BY 4 DESC LIMIT {limit:d} ``` -------------------------------- ### Define Schema Parameters in YAML Source: https://docs.snowddl.com/basic/yaml-configs/schema Example configuration for a schema using params.yaml to set retention, sandbox status, and various owner-level grants. ```yaml retention_time: 7 is_sandbox: true owner_schema_read: - another_db.another_schema_1 - another_db.another_schema_2 owner_warehouse_usage: - my_warehouse owner_integration_usage: - my_storage_integration owner_account_grants: - EXECUTE ALERT ``` -------------------------------- ### Define a Table Blueprint Source: https://docs.snowddl.com/advanced/architecture-overview/blueprints Example of a TableBlueprint class inheriting from SchemaObjectBlueprint, defining columns and configuration options. ```python class TableBlueprint(SchemaObjectBlueprint): columns: List[TableColumn] cluster_by: Optional[List[str]] = None is_transient: bool = False retention_time: Optional[int] = None change_tracking: bool = False search_optimization: Union[bool, List[SearchOptimizationItem]] = False ``` -------------------------------- ### Define Airbyte Permission Model Source: https://docs.snowddl.com/guides/other-guides/airbyte Configure database, user, and permissions for Airbyte using a custom permission model. This example sets ownership and future grants for stages, tables, and views. ```yaml airbyte: ruleset: DATABASE_OWNER owner_create_grants: - STAGE - TABLE - VIEW owner_future_grants: STAGE: [OWNERSHIP] TABLE: [OWNERSHIP] VIEW: [OWNERSHIP] read_future_grants: STAGE: [READ] TABLE: [SELECT, REFERENCES] VIEW: [SELECT, REFERENCES] ``` -------------------------------- ### Secret Configuration Source: https://docs.snowddl.com/basic/yaml-configs/secret Configuration examples for different secret types in SnowDDL. ```APIDOC ## Secret Configuration Examples ### OAuth2 Secret Config path: `///secret/.yaml` ```yaml type: oauth2 api_authentication: TEST_API_SECURITY_INTEGRATION # Optional: oauth_scopes: ["scope1", "scope2"] oauth_refresh_token: RjY2NjM5NzA2OWJjuE7c oauth_refresh_token_expiry_time: "2030-01-01 00:00:00" ``` ### Generic String Secret Config path: `///secret/.yaml` ```yaml type: generic_string secret_string: very secret string! ``` ``` -------------------------------- ### Snowflake Object Ownership Hierarchy Example Source: https://docs.snowddl.com/guides/other-guides/ownership Illustrates the ownership structure for various Snowflake objects within a database and schema, managed by SnowDDL. ```text MY_DB (owned by SNOWDDL_ADMIN) |-- MY_SCHEMA (owned by SNOWDDL_ADMIN) |-- MY_TABLE (owned by MY_DB__MY_SCHEMA__OWNER__S_ROLE) |-- MY_VIEW (owned by MY_DB__MY_SCHEMA__OWNER__S_ROLE) |-- MY_FUNCTION (owned by MY_DB__MY_SCHEMA__OWNER__S_ROLE) MY_WAREHOUSE (owned by SNOWDDL_ADMIN) MY_USER (owned by SNOWDDL_ADMIN) MY_RESOURCE_MONITOR (owned by SNOWDDL_ADMIN) ``` -------------------------------- ### Define a Masking Policy in YAML Source: https://docs.snowddl.com/basic/yaml-configs/masking-policy Example configuration for a masking policy, including arguments, return type, and the SQL body expression. ```yaml arguments: name: VARCHAR(255) returns: VARCHAR(255) body: |- REPLACE(name, 'A', '*') references: - object_type: TABLE object_name: test_table_1 columns: [name] ``` -------------------------------- ### Extended Custom Permission Model Source: https://docs.snowddl.com/basic/yaml-configs/permission-model An example of extending the default model by inheriting its settings and adding additional grants. ```yaml my_custom_model: inherit_from: default owner_create_grants: - STAGE read_future_grants: STAGE: [USAGE] ``` -------------------------------- ### Example Authentication Policy Configuration Source: https://docs.snowddl.com/basic/yaml-configs/authentication-policy This YAML snippet defines an authentication policy for a Snowflake database. It specifies allowed authentication methods, MFA requirements, client types, and security integrations. Ensure compatibility with Snowflake's current bundle version. ```yaml authentication_methods: [SAML, KEYPAIR] mfa_authentication_methods: [SAML] mfa_enrollment: REQUIRED client_types: [SNOWFLAKE_UI, DRIVERS] security_integrations: [ALL] comment: "my custom policy" ``` -------------------------------- ### Define a CSV File Format in YAML Source: https://docs.snowddl.com/basic/yaml-configs/file-format Example configuration for a CSV file format with GZIP compression and specific delimiter settings. ```yaml type: CSV format_options: compression: GZIP record_delimiter: "\n" field_delimiter: "," skip_header: 1 trim_space: true ``` -------------------------------- ### Apply Placeholders via CLI Source: https://docs.snowddl.com/basic/yaml-placeholders Using the --placeholder-path option to provide a custom placeholder configuration file. ```bash snowddl \ -c \ -a \ -u \ -p \ --placeholder-path= apply ``` -------------------------------- ### Configure Database Backup Set Source: https://docs.snowddl.com/basic/yaml-configs/backup-set Use this configuration to set up backups for an entire database. Ensure the object_type and object_name are correctly specified. ```yaml object_type: DATABASE object_name: my_database ``` -------------------------------- ### Apply SnowDDL Configuration Source: https://docs.snowddl.com/getting-started Apply configuration samples to your Snowflake account. Replace placeholders with your specific account identifier and private key path. ```bash snowddl \ -c sample01_01 \ -a \ -u snowddl \ -k \ --apply-unsafe \ apply ``` ```bash snowddl \ -c sample01_02 \ -a \ -u snowddl \ -k \ --apply-unsafe \ apply ``` -------------------------------- ### Define a Snowflake sequence in YAML Source: https://docs.snowddl.com/basic/yaml-configs/sequence Basic configuration for a sequence defining the starting value and increment interval. ```yaml start: 1 interval: 1 ``` -------------------------------- ### Python Query Formatting Source: https://docs.snowddl.com/advanced/query-builder-and-formatter Demonstrates how to define parameters and use the engine's format method to generate the final SQL string. ```python # SQL with formatting params = { 'common_val': 'abc', 'null_val': None, 'col_name': Ident('NULL_VAL') 'table_name': IdentWithPrefix(env_prefix='ALICE__', 'MY_DB', 'MY_SCHEMA', 'USERS'), 'user_rating': '0.5', 'user_score': 1e1, 'is_female': True, 'user_statuses': ['ACTIVE', 'PASSIVE', 'SUSPENDED'], 'exclude_user_score': [10, 20], 'limit': 10 } print(engine.format(query, params)) ``` -------------------------------- ### Define an outbound share in YAML Source: https://docs.snowddl.com/basic/yaml-configs/share-outbound Example configuration for a Snowflake outbound share, including account access and object grants. ```yaml test_share: accounts: - SFSALESSHARED.SFC_SAMPLES_AWS_EU_WEST_2 grants: DATABASE:USAGE: - test_db SCHEMA:USAGE: - test_db.test_schema TABLE:SELECT: - test_db.test_schema.* FUNCTION:USAGE: - test_db.test_schema.test_secure_udf(varchar) DATABASE_ROLE:USAGE: - test_db.test_database_role comment: Test share ``` -------------------------------- ### Create Storage Integration Source: https://docs.snowddl.com/guides/other-guides/integrations Use this SQL command to create a storage integration for external stages. Ensure the integration is enabled and allowed locations are configured. ```sql CREATE STORAGE INTEGRATION TEST_STORAGE_INTEGRATION TYPE = EXTERNAL_STAGE STORAGE_PROVIDER = GCS ENABLED = TRUE STORAGE_ALLOWED_LOCATIONS = ('*'); GRANT USAGE ON INTEGRATION TEST_STORAGE_INTEGRATION TO ROLE SNOWDDL_ADMIN; ``` -------------------------------- ### Build and Execute SQL Query with SnowDDL Source: https://docs.snowddl.com/advanced/query-builder-and-formatter Use the query builder to construct a SQL query by appending fragments and then execute it using the engine. Ensure the 'engine' object is initialized. ```python query = engine.query_builder() # Fill the first line query.append("SELECT") query.append("id AS user_id") query.append("name AS user_name") # Add a new line with identifier as parameter query.append_nl("FROM {table_name:i}", { "table_name": Ident('MY_TABLE') }) # Add another line with filters query.append_nl("WHERE") query.append_nl("country_id = {country_id:d}", { "country_id": 10 }) # Display query print(query) # Execute query engine.execute_meta(query) ``` -------------------------------- ### Configure an Alert with SQL Condition and Action Source: https://docs.snowddl.com/basic/yaml-configs/alert Use this YAML structure to define an alert, specifying the warehouse, schedule, a SQL condition to monitor, and a SQL action to execute when the condition is met. Ensure SQL statements use fully-qualified identifiers with the `${{ env_prefix }}` placeholder. ```yaml warehouse: al001_wh1 schedule: 1 minute condition: |- SELECT gauge_value FROM ${{ env_prefix }}db1.sc1.gauge WHERE gauge_value>200 action: |- INSERT INTO ${{ env_prefix }}db1.sc1.gauge_value_exceeded_history VALUES (current_timestamp()) ``` -------------------------------- ### Check Role in Aggregation Policy Source: https://docs.snowddl.com/basic/yaml-configs/aggregation-policy Example of a conditional check to allow aggregation for the SYSADMIN role, preventing issues with view recreation. ```sql CASE WHEN IS_ROLE_IN_SESSION('SYSADMIN') THEN NO_AGGREGATION_CONSTRAINT() ELSE ... END ``` -------------------------------- ### Configure Airbyte Database Source: https://docs.snowddl.com/guides/other-guides/airbyte Set up the database configuration for Airbyte. It's recommended to enable `quoted_identifiers_ignore_case` to handle Airbyte's use of lower-case characters for internal stage names. ```yaml is_sandbox: true permission_model: airbyte quoted_identifiers_ignore_case: true ``` -------------------------------- ### Basic Task Configuration Source: https://docs.snowddl.com/basic/yaml-configs/task Defines a task with a SQL body and a schedule. Tasks are initially suspended and require manual resumption. ```yaml body: |- CALL test_procedure_1(1) schedule: 5 MINUTE warehouse: task_wh ``` -------------------------------- ### Configure Placeholder Values Source: https://docs.snowddl.com/basic/yaml-placeholders Defining placeholder values in the configuration file or via environment-specific override files. ```yaml wh_size: SMALL wh_auto_suspend: 300 bucket_name: dev-test-bucket ``` ```yaml bucket_name: prod-test-bucket ``` -------------------------------- ### Check Projection Policy Role Access Source: https://docs.snowddl.com/basic/yaml-configs/projection-policy Example SQL snippet used within the policy body to ensure the SYSADMIN role has appropriate access. ```sql CASE WHEN IS_ROLE_IN_SESSION('SYSADMIN') THEN PROJECTION_CONSTRAINT(ALLOW => true) ELSE ... END ``` -------------------------------- ### Query Builder API Source: https://docs.snowddl.com/advanced/query-builder-and-formatter The Query Builder API allows for the construction of SQL queries by appending fragments to lines or starting new lines. It supports parameter formatting. ```APIDOC ## Query Builder API ### Description Used to build complex SQL queries from small fragments. Each fragment can be added to the current line or start a new line. ### Methods * `append(sql, params=None)` Appends a fragment to the current line. Optionally formats it using placeholders and dictionary with params. * `append_nl(sql, params=None)` Starts a new line and append a fragment to it. Optionally formats it using placeholders and dictionary with params. * `fragment_count()` Returns a number of fragments across all lines. * `add_short_hash(comment)` Part of the short hash feature. Takes the comment for an object and adds a short hash at the end. Returns the updated comment. * `compare_short_hash(comment)` Part of the short hash feature. Extracts the short hash from an existing comment and compares it with the expected short hash. Returns `True` if hashes are the same, returns `False` otherwise. * `__str__()` Query builder objects can be used as normal strings. ### Example Usage ```python query = engine.query_builder() # Fill the first line query.append("SELECT") query.append("id AS user_id") query.append("name AS user_name") # Add a new line with identifier as parameter query.append_nl("FROM {table_name:i}", { "table_name": Ident('MY_TABLE') }) # Add another line with filters query.append_nl("WHERE") query.append_nl("country_id = {country_id:d}", { "country_id": 10 }) # Display query print(query) # Execute query engine.execute_meta(query) ``` ``` -------------------------------- ### Configure a Basic Warehouse Source: https://docs.snowddl.com/basic/yaml-configs/warehouse Define a standard warehouse with a specific size and auto-suspend time. Ensure the size is valid according to Snowflake documentation. ```yaml task_wh: size: XSMALL auto_suspend: 60 ``` -------------------------------- ### Decrypt User Password in YAML Source: https://docs.snowddl.com/basic/yaml-tag-decrypt Example of using the !decrypt tag for a user's password in a YAML configuration file. Ensure the Fernet keys are available in the SNOWFLAKE_CONFIG_FERNET_KEYS environment variable. ```yaml john_doe: first_name: John last_name: Doe password: !decrypt gAAAAABmlTWBmENR0wIG2naG3PW8B3Li-9tw2UQAb9yB22V_R-SEEq6Vli5m9-w5_tI3jlftIGxlXxPhsLNMngxnjG6XdySHpQ== ``` -------------------------------- ### Create and Configure Administration Warehouse for SnowDDL Source: https://docs.snowddl.com/guides/other-guides/admin This SQL script creates a dedicated warehouse for SnowDDL, configures its properties, and grants necessary privileges to the SNOWDDL_ADMIN role. It also sets this warehouse as the default for the SNOWDDL user. ```sql USE ROLE ACCOUNTADMIN; CREATE WAREHOUSE SNOWDDL_WH WAREHOUSE_SIZE = 'XSMALL' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE; GRANT USAGE, OPERATE ON WAREHOUSE SNOWDDL_WH TO ROLE SNOWDDL_ADMIN; ALTER USER SNOWDDL SET DEFAULT_WAREHOUSE = SNOWDDL_WH; ``` -------------------------------- ### Define YAML Placeholders Source: https://docs.snowddl.com/basic/yaml-placeholders Syntax for using placeholders within YAML configuration files. ```yaml ${{ }} ``` ```yaml my_warehouse: size: ${{ wh_size }} auto_suspend: ${{ wh_auto_suspend }} ``` ```yaml url: s3://${{ bucket_name }}/my_path/ storage_integration: test_storage_integration file_format: test_avro_format ``` -------------------------------- ### Pass Placeholders via CLI Arguments Source: https://docs.snowddl.com/basic/yaml-placeholders Providing placeholder values directly as a JSON string using the --placeholder-values argument. ```bash snowddl \ -c \ -a \ -u \ -p \ --placeholder-values="{\"bucket_name\": \"prod-test-bucket\"}" apply ``` -------------------------------- ### SnowDDLConfig Class Methods Source: https://docs.snowddl.com/advanced/architecture-overview/config This section details the methods available for interacting with the SnowDDLConfig object. ```APIDOC ## SnowDDLConfig Methods ### `__init__(env_prefix=None)` Initialize config with optional environment prefix. ### `get_blueprints_by_type(cls: Type[T_Blueprint]) -> Dict[str,T_Blueprint]` Accepts blueprint type (class). Returns all blueprints of this type. ### `get_blueprints_by_type_and_pattern(cls: Type[T_Blueprint], pattern: IdentPattern) -> Dict[str,T_Blueprint]` Accepts blueprint type (class) and Unix-style pattern. Returns all blueprints of this type with full names matching pattern. ### `add_blueprint(bp: AbstractBlueprint)` Accepts an instance of a blueprint and adds it to the collection. Replaces existing blueprints with the same full name. ### `remove_blueprint(bp: AbstractBlueprint)` Accepts an instance of a blueprint and removes it from the collection. Throws `ValueError` if the blueprint does not exist. ``` -------------------------------- ### Policy Reference Parameters Source: https://docs.snowddl.com/basic/yaml-configs/user Details on how to assign authentication and network policies to users. ```APIDOC ## Policy reference parameters * **authentication_policy** (ident) - assign [AUTHENTICATION POLICY](https://docs.snowddl.com/basic/yaml-configs/authentication-policy) to USER * **network_policy** (ident) - assign [NETWORK POLICY](https://docs.snowddl.com/basic/yaml-configs/network-policy) to USER ``` -------------------------------- ### Configure Table Backup Set Source: https://docs.snowddl.com/basic/yaml-configs/backup-set Set up backups for a specific table. This configuration allows for an optional backup_policy to be assigned. ```yaml object_type: TABLE object_name: my_table backup_policy: my_snapshot_policy ``` -------------------------------- ### Create Notification Integration Source: https://docs.snowddl.com/guides/other-guides/integrations Use this SQL command to set up a notification integration for outbound queue types, such as AWS SNS. Configure the provider, role ARN, and topic ARN. ```sql CREATE NOTIFICATION INTEGRATION TEST_NOTIFICATION_INTEGRATION DIRECTION = OUTBOUND TYPE = QUEUE NOTIFICATION_PROVIDER=AWS_SNS AWS_SNS_ROLE_ARN='arn:aws:iam::123456789012:role/my_cloud_account_role' AWS_SNS_TOPIC_ARN='arn:aws:sns:us-east-1:123456789012:MyTopic' ENABLED=TRUE; GRANT USAGE ON INTEGRATION TEST_NOTIFICATION_INTEGRATION TO ROLE SNOWDDL_ADMIN; ``` -------------------------------- ### Create Airbyte User Source: https://docs.snowddl.com/guides/other-guides/airbyte Configure a user for Airbyte, including its public RSA key and assigned business roles. ```yaml ext_airbyte: rsa_public_key: ... business_roles: - airbyte_owner ``` -------------------------------- ### Configure Account Parameters with YAML Source: https://docs.snowddl.com/basic/yaml-configs/account-parameter Use this YAML structure to define account-level parameters for SnowDDL. Ensure parameter values match the expected data types as shown by 'SHOW PARAMETERS IN ACCOUNT'. ```yaml ABORT_DETACHED_QUERY: true CLIENT_TIMESTAMP_TYPE_MAPPING: "TIMESTAMP_NTZ" ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR: true ERROR_ON_NONDETERMINISTIC_MERGE: true ERROR_ON_NONDETERMINISTIC_UPDATE: true JDBC_TREAT_TIMESTAMP_NTZ_AS_UTC: true LOCK_TIMEOUT: 3600 PREVENT_UNLOAD_TO_INLINE_URL: true REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_CREATION: true REQUIRE_STORAGE_INTEGRATION_FOR_STAGE_OPERATION: true STATEMENT_QUEUED_TIMEOUT_IN_SECONDS: 10800 STATEMENT_TIMEOUT_IN_SECONDS: 10800 TIMESTAMP_NTZ_OUTPUT_FORMAT: "YYYY-MM-DD HH24:MI:SS" TIMESTAMP_OUTPUT_FORMAT: "YYYY-MM-DD HH24:MI:SS TZHTZM" TIMESTAMP_TYPE_MAPPING: "TIMESTAMP_NTZ" TIMEZONE: "Etc/UTC" TRANSACTION_ABORT_ON_ERROR: true UNSUPPORTED_DDL_ACTION: "FAIL" WEEK_START: "1" ALLOW_CLIENT_MFA_CACHING: true ALLOW_ID_TOKEN: true ``` -------------------------------- ### Update TechnicalRoleBlueprint with GrantPattern Source: https://docs.snowddl.com/breaking-changes-log/0.37.0-december-2024 Technical roles now utilize GrantPattern objects to define permissions. ```python TechnicalRoleBlueprint( full_name=AccountObjectIdent(self.env_prefix, "my_tech_role"), grants=[Grant(privilege="USAGE", on=ObjectType.DATABASE, name=DatabaseIdent(...))], ) ``` ```python TechnicalRoleBlueprint( full_name=AccountObjectIdent(self.env_prefix, "my_tech_role"), grant_patterns=[GrantPattern(privilege="USAGE", on=ObjectType.DATABASE, name=IdentPattern(...))], ) ``` -------------------------------- ### Define Network Policies in YAML Source: https://docs.snowddl.com/basic/yaml-configs/network-policy Configure network policies using either IP lists or fully qualified network rule references. ```yaml test_network_policy_1: allowed_ip_list: - 0.0.0.0/0 blocked_ip_list: - 1.1.1.1 - 8.8.8.8 test_network_policy_2: allowed_network_rule_list: - my_db.my_schema.my_rule_1 - my_db.my_schema.my_rule_2 blocked_network_rule_list: - my_db.my_schema.my_rule_3 - my_db.my_schema.my_rule_4 ``` -------------------------------- ### Configure a Snowpipe with COPY INTO Source: https://docs.snowddl.com/basic/yaml-configs/pipe Define a Snowpipe configuration in YAML format. Specify the target table, source stage, and transformation rules for data ingestion. Set auto_ingest to false if manual control is preferred. ```yaml copy: table: test_table_2 stage: test_external_stage transform: id: "GET($1, 'id')" name: "GET($1, 'name')" auto_ingest: false ``` -------------------------------- ### Generate dynamic views from existing blueprints Source: https://docs.snowddl.com/advanced/programmatic-config Scans existing table blueprints using pattern matching to dynamically construct and add a new ViewBlueprint. ```python from snowddl import SchemaObjectIdent, SnowDDLConfig, TableBlueprint, ViewBlueprint def handler(config: SnowDDLConfig): # Add view combining all custom tables parts = [] for full_name, bp in config.get_blueprints_by_type_and_pattern(TableBlueprint, "test_db.test_schema.custom_table_*").items(): parts.append(f"SELECT id, name FROM {full_name}") bp = ViewBlueprint( full_name=SchemaObjectIdent(config.env_prefix, "test_db", "test_schema", "custom_view"), text="\nUNION ALL\n".join(parts), comment="This view was created programmatically", ) config.add_blueprint(bp) ``` -------------------------------- ### Define a Resource Monitor in YAML Source: https://docs.snowddl.com/basic/yaml-configs/resource-monitor Use this structure in resource_monitor.yaml to define a monitor with specific credit quotas and threshold-based triggers. ```yaml test_res_monitor_1: credit_quota: 125 frequency: monthly triggers: 50: notify 75: notify 100: suspend 110: suspend_immediate ``` -------------------------------- ### Configure an Event Table Source: https://docs.snowddl.com/basic/yaml-configs/event-table Use this YAML configuration to define an event table, enabling change tracking and adding a descriptive comment. Ensure the config path follows the specified format. ```yaml change_tracking: true comment: Event table tracking UDF execution logs ``` -------------------------------- ### Define a Projection Policy in YAML Source: https://docs.snowddl.com/basic/yaml-configs/projection-policy Standard configuration format for a projection policy, including the SQL body and optional metadata. ```yaml body: |- CASE WHEN IS_ROLE_IN_SESSION('SYSADMIN') THEN PROJECTION_CONSTRAINT(ALLOW => true) ELSE PROJECTION_CONSTRAINT(ALLOW => true) END references: - object_type: TABLE object_name: test_table_1 column: id - object_type: VIEW object_name: test_view_1 column: id comment: my projection policy ``` -------------------------------- ### User Configuration with RSA Public Key Source: https://docs.snowddl.com/basic/yaml-configs/user Configures a user for key-pair authentication using an RSA public key. The key should be provided without delimiters. ```yaml etl_script: rsa_public_key: >- MIIBIjANBgkqhkiG1a0BAQEFAAOCAQ8AMIIBCgKCAQEAx4INStnNQshPamlDe5te +sF/J3zbY9BCMgcl/B11NndFRuXZjKBAyVJyJdjm2XpHGyJZrpIf1kBVJbfxpNSi qN/VLMm1nsqtEnLJsvHWT4AyJ8GG1ahYY34ody9SjLTCisSRpjzh7ZLajbyNtwbH ukOCAhy1R7RzyEmuqz3rRmnx0MUb+1wdSYfMAnVwxT11otmClhXVe3Hj9hdNmljk pw2rezWlKyeywkDpvh00/tuIFdCJD2gWcb3rAUC3e9iR6RJ4o/LFIEBlyktUPOqF d4A3+Wp/pkTiYUh2GvjHTZrGViZXBPRjciP+6ktLMuXP4bW2DeS1xEYIUeYhxaNI IwIDAQAB business_roles: - etl_script ``` -------------------------------- ### Define a Backup Policy in YAML Source: https://docs.snowddl.com/basic/yaml-configs/backup-policy Use this structure to define a backup policy within the ///backup_policy/ directory. ```yaml schedule: 90 minutes expire_after_days: 30 comment: My snapshot policy ```