Skip to content

Commit

Permalink
Adding Documentation + Scripts for teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tmathew committed Apr 14, 2024
1 parent 2c851fc commit de00956
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
9 changes: 9 additions & 0 deletions demo/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# PROVISION

# Setup

# Teardown

# citibike

# citibike jinja
19 changes: 13 additions & 6 deletions demo/teardown/teardown_citibike_demo.sql
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
SET TARGET_SCHEMA_NAME = 'CITIBIKE_DEMO';
SET TARGET_DB_NAME = 'SCHEMACHANGE_DEMO'; -- Name of database that will have the SCHEMACHANGE Schema for change tracking.

-- Dependent Variables; Change the naming pattern if you want but not necessary
SET ADMIN_ROLE = $TARGET_DB_NAME || '_ADMIN'; -- This role will own the database and schemas.
SET DEPLOY_ROLE = $TARGET_DB_NAME || '_DEPLOY'; -- This role will be granted privileges to create objects in any schema in the database
SET SERVICE_USER = $TARGET_DB_NAME || '_SVC_USER'; -- This user will be granted the Deploy role.
SET WAREHOUSE_NAME = $TARGET_DB_NAME || '_WH';
SET AC_U = '_AC_U_' || $WAREHOUSE_NAME;
SET AC_O = '_AC_O_' || $WAREHOUSE_NAME;
SET SCHEMACHANGE_NAMESPACE = $TARGET_DB_NAME || '.' || $TARGET_SCHEMA_NAME;
SET SC_M = 'SC_M_' || $TARGET_SCHEMA_NAME;
SET SC_R = 'SC_R_' || $TARGET_SCHEMA_NAME;
SET SC_W = 'SC_W_' || $TARGET_SCHEMA_NAME;
SET SC_C = 'SC_C_' || $TARGET_SCHEMA_NAME;

USE ROLE IDENTIFIER($ADMIN_ROLE);
USE DATABASE IDENTIFIER($TARGET_DB_NAME);
USE SCHEMA INFORMATION_SCHEMA;

DROP DATABASE IF EXISTS IDENTIFIER($TARGET_DB_NAME);
DROP WAREHOUSE IF EXISTS IDENTIFIER($WAREHOUSE_NAME);
DROP SCHEMA IF EXISTS IDENTIFIER($TARGET_SCHEMA_NAME);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_C);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_W);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_R);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_M);

22 changes: 22 additions & 0 deletions demo/teardown/teardown_citibike_demo_jinja.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
SET TARGET_SCHEMA_NAME = 'CITIBIKE_DEMO_JINJA';
SET TARGET_DB_NAME = 'SCHEMACHANGE_DEMO'; -- Name of database that will have the SCHEMACHANGE Schema for change tracking.
-- Dependent Variables; Change the naming pattern if you want but not necessary
SET ADMIN_ROLE = $TARGET_DB_NAME || '_ADMIN'; -- This role will own the database and schemas.
SET DEPLOY_ROLE = $TARGET_DB_NAME || '_DEPLOY'; -- This role will be granted privileges to create objects in any schema in the database
SET WAREHOUSE_NAME = $TARGET_DB_NAME || '_WH';
SET SCHEMACHANGE_NAMESPACE = $TARGET_DB_NAME || '.' || $TARGET_SCHEMA_NAME;
SET SC_M = 'SC_M_' || $TARGET_SCHEMA_NAME;
SET SC_R = 'SC_R_' || $TARGET_SCHEMA_NAME;
SET SC_W = 'SC_W_' || $TARGET_SCHEMA_NAME;
SET SC_C = 'SC_C_' || $TARGET_SCHEMA_NAME;

USE ROLE IDENTIFIER($ADMIN_ROLE);
USE DATABASE IDENTIFIER($TARGET_DB_NAME);
USE SCHEMA INFORMATION_SCHEMA;

DROP SCHEMA IF EXISTS IDENTIFIER($TARGET_SCHEMA_NAME);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_C);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_W);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_R);
DROP DATABASE ROLE IF EXISTS IDENTIFIER($SC_M);

0 comments on commit de00956

Please sign in to comment.