Snowflake Deployment
Purpose
Section titled “Purpose”Generate a deployment script that contains deployment calls for all generated (output) code.
Motivation
Section titled “Motivation”Once the contents is created, a central deployment script can also be generated.
This can call each individual process or file to run the full deployment to a target in one pass.
Applicability
Section titled “Applicability”- All design metadata
Design Pattern
Section titled “Design Pattern”N/A
Schema Type
Section titled “Schema Type”N/A
Output Type
Section titled “Output Type”- SQL
Implementation guidelines
Section titled “Implementation guidelines”This template covers all design metadata.
Considerations and consequences
Section titled “Considerations and consequences”N/A.
Extensions
Section titled “Extensions”N/A.
/* Deployment for use in SnowSQL or equivalent. For example from the root 'output' directory: snowsql -c <env> --authenticator 'externalbrowser' -f .\Databases\Deployment\Deployment.sql*/
/* Data Objects*/{{!-- Source objects --}}{{#each dataObjects}}{{~#if @first}}-- Source objects{{/if}}{{#hasClassification classifications "Source"}}!source .\Databases\\{{../../conventions.sourceObjectLocation}}\Tables\\{{name}}.sql{{/hasClassification~}}{{/each}}{{!-- Spacer --}}{{#if false}}
{{else}}
{{/if}}{{!-- Landing objects --}}{{#each dataObjects}}{{~#if @first}}-- Landing objects{{/if}}{{#hasClassification classifications "Landing"}}!source .\Databases\\{{../../conventions.landingAreaObjectLocation}}\Tables\\{{name}}.sql{{/hasClassification~}}{{/each}}{{!-- Spacer --}}{{#if false}}
{{else}}
{{/if}}{{!-- Persistent Staging objects --}}{{#each dataObjects}}{{~#if @first}}-- Persistent staging objects{{/if}}{{#hasClassification classifications "Persistent Staging"}}!source .\Databases\\{{../../conventions.persistentStagingAreaObjectLocation}}\Tables\\{{name}}.sql{{/hasClassification~}}{{/each}}
/*---- Drop-only script--
{{!-- Source objects --}}{{#each dataObjects}}{{~#if @first}}-- Source objects{{/if}}{{#hasClassification classifications "Source"}}DROP TABLE IF EXISTS "{{../../conventions.sourceObjectLocation}}.{{name}}";{{/hasClassification~}}{{/each}}{{!-- Spacer --}}{{#if false}}
{{else}}
{{/if}}{{!-- Landing objects --}}{{#each dataObjects}}{{~#if @first}}-- Landing objects{{/if}}{{#hasClassification classifications "Landing"}}DROP TABLE IF EXISTS "{{../../conventions.landingAreaObjectLocation}}.{{name}}";{{/hasClassification~}}{{/each}}{{!-- Spacer --}}{{#if false}}
{{else}}
{{/if}}{{!-- Persistent Staging objects --}}{{#each dataObjects}}{{~#if @first}}-- Persistent staging objects{{/if}}{{#hasClassification classifications "Persistent Staging"}}DROP TABLE IF EXISTS "{{../../conventions.persistentStagingAreaObjectLocation}}.{{name}}";{{/hasClassification~}}{{/each}}*/
/* Stored Procedures*/{{!-- Landing --}}{{#each dataObjects}}{{~#if @first}}-- Landing objects{{/if}}{{#hasClassification classifications "Landing"}}--!source .\Databases\\{{../../conventions.landingAreaObjectLocation}}\"Stored Procedures"\\{{name}}.sql{{/hasClassification~}}{{/each}}{{!-- Spacer --}}{{#if false}}
{{else}}
{{/if}}{{!-- Persistent Staging --}}{{#each dataObjects}}{{~#if @first}}-- Persistent staging objects{{/if}}{{#hasClassification classifications "Persistent Staging"}}--!source .\Databases\\{{../../conventions.persistentStagingAreaObjectLocation}}\"Stored Procedures"\\{{name}}.sql{{/hasClassification~}}{{/each}}