Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed demo scripts that were failing and updated version to 4.0.0 #297

Merged
merged 6 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.

*The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).*

## [4.0.0] - TBD
### Added
- use of structlog for standard log outputs

### Changed
- Refactored the main cli.py to be more modular to aide in future development and testing.


## [3.7.0] - 2024-07-22
### Added
- Improved unit test coverage
Expand Down
2 changes: 2 additions & 0 deletions demo/basics_demo/V1.0.2__StoredProc.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use database {{ database_name }};
use schema {{ schema_name }};
-- This block of code executes in Visual Studio Code but fails in Schemachange.
-- Use the $$ ... $$ to mark the block and execute the code block successfully.
-- The comment from a community user help find the root cause.
Expand Down
3 changes: 3 additions & 0 deletions demo/provision/setup_schemachange_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ CREATE DATABASE ROLE IF NOT EXISTS DB_R;
CREATE DATABASE ROLE IF NOT EXISTS DB_W;
CREATE DATABASE ROLE IF NOT EXISTS DB_C;

GRANT CREATE SCHEMA ON DATABASE IDENTIFIER($TARGET_DB_NAME) TO DATABASE ROLE DB_C;

GRANT DATABASE ROLE DB_C TO ROLE IDENTIFIER($DEPLOY_ROLE);

CREATE DATABASE ROLE IF NOT EXISTS IDENTIFIER($SC_M);
Expand All @@ -38,6 +40,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C);
CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS;
-- USE SCHEMA INFORMATION_SCHEMA;
-- DROP SCHEMA IF EXISTS PUBLIC;
GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE);

USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE);
-- SCHEMA
Expand Down
1 change: 1 addition & 0 deletions demo/setup/basics_demo/A__setup_basics_demo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C);
CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS;
-- USE SCHEMA INFORMATION_SCHEMA;
-- DROP SCHEMA IF EXISTS PUBLIC;
GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE);

USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE);
-- SCHEMA
Expand Down
1 change: 1 addition & 0 deletions demo/setup/citibike_demo/A__setup_citibike_demo.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C);
CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS;
-- USE SCHEMA INFORMATION_SCHEMA;
-- DROP SCHEMA IF EXISTS PUBLIC;
GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE);

USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE);
-- SCHEMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ GRANT DATABASE ROLE IDENTIFIER($SC_W) TO DATABASE ROLE IDENTIFIER($SC_C);
CREATE SCHEMA IF NOT EXISTS IDENTIFIER($TARGET_SCHEMA_NAME) WITH MANAGED ACCESS;
-- USE SCHEMA INFORMATION_SCHEMA;
-- DROP SCHEMA IF EXISTS PUBLIC;
GRANT OWNERSHIP ON SCHEMA IDENTIFIER($TARGET_SCHEMA_NAME) TO ROLE IDENTIFIER($DEPLOY_ROLE);

USE SCHEMA IDENTIFIER($SCHEMACHANGE_NAMESPACE);
-- SCHEMA
Expand Down
2 changes: 1 addition & 1 deletion schemachange/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# region Global Variables
# metadata
SCHEMACHANGE_VERSION = "3.7.0"
SCHEMACHANGE_VERSION = "4.0.0"
SNOWFLAKE_APPLICATION_NAME = "schemachange"
module_logger = structlog.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


def test_cli_given__schemachange_version_change_updated_in_setup_config_file():
assert SCHEMACHANGE_VERSION == "3.7.0"
assert SCHEMACHANGE_VERSION == "4.0.0"


def test_cli_given__constants_exist():
Expand Down