diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index b9945082..b9d6d20f 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -11,4 +11,4 @@ jobs: - name: 'Checkout Repository' uses: actions/checkout@v4 - name: 'Dependency Review' - uses: actions/dependency-review-action@v3 + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/dev-pytest.yml b/.github/workflows/dev-pytest.yml index 02ed99f6..75f0ef15 100644 --- a/.github/workflows/dev-pytest.yml +++ b/.github/workflows/dev-pytest.yml @@ -1,4 +1,4 @@ -name: pytest +name: dev-pytest on: push: @@ -8,6 +8,8 @@ on: pull_request: types: [opened, reopened] + workflow_dispatch: + jobs: build: diff --git a/.github/workflows/pytest.yml b/.github/workflows/master-pytest.yml similarity index 97% rename from .github/workflows/pytest.yml rename to .github/workflows/master-pytest.yml index c31d4ded..ff5db01a 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/master-pytest.yml @@ -1,4 +1,4 @@ -name: pytest +name: master-pytest on: push: diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index bdaab28a..15e93dde 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -21,9 +21,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ff9c8c4..bf54e385 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,10 +2,17 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer + - id: check-ast + - id: check-case-conflict + - id: check-docstring-first + - id: check-merge-conflict + - id: check-toml + - id: check-yaml + - id: name-tests-test - repo: https://github.com/asottile/setup-cfg-fmt rev: v2.4.0 hooks: @@ -22,14 +29,4 @@ repos: - id: ruff args: [ --fix ] # Run the formatter. - - id: ruff-format - # Using this mirror lets us use mypyc-compiled black, which is about 2x faster - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.3.0 - hooks: - - id: black - # It is recommended to specify the latest version of Python - # supported by your project here, or alternatively use - # pre-commit's default_language_version, see - # https://pre-commit.com/#top_level-default_language_version - language_version: python3.11 + - id: ruff-format \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 63e4b8fe..618cb8ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ 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).* +## [3.6.2] - 2023-12-07 +### Changed +- Aligning with snowflake [identifier requirements](https://docs.snowflake.com/en/sql-reference/identifiers-syntax). + ## [3.6.1] - 2023-11-15 ### Added - Allow passing snowflake schema as config or CLI parameter diff --git a/pyproject.toml b/pyproject.toml index 9ac9b912..4ba14420 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,4 +3,4 @@ requires = [ "setuptools >= 40.9.0", "wheel", ] -build-backend = "setuptools.build_meta" +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/schemachange/cli.py b/schemachange/cli.py index 34a81b15..43e02132 100644 --- a/schemachange/cli.py +++ b/schemachange/cli.py @@ -20,7 +20,7 @@ # region Global Variables # metadata -_schemachange_version = "3.6.1" +_schemachange_version = "3.6.2" _config_file_name = "schemachange-config.yml" _metadata_database_name = "METADATA" _metadata_schema_name = "SCHEMACHANGE" @@ -267,10 +267,10 @@ class SnowflakeSchemachangeSession: + "'{script_description}','{script_name}','{script_type}','{checksum}',{execution_time}," + "'{status}','{user}',CURRENT_TIMESTAMP);" ) - _q_set_sess_role = "USE ROLE {role};" - _q_set_sess_database = "USE DATABASE {database};" - _q_set_sess_schema = "USE SCHEMA {schema};" - _q_set_sess_warehouse = "USE WAREHOUSE {warehouse};" + _q_set_sess_role = "USE ROLE IDENTIFIER({role});" + _q_set_sess_database = "USE DATABASE IDENTIFIER({database});" + _q_set_sess_schema = "USE SCHEMA IDENTIFIER({schema});" + _q_set_sess_warehouse = "USE WAREHOUSE IDENTIFIER({warehouse});" # endregion Query Templates def __init__(self, config): @@ -884,7 +884,7 @@ def get_all_scripts_recursively(root_directory, verbose): all_files = dict() all_versions = list() # Walk the entire directory structure recursively - for (directory_path, directory_names, file_names) in os.walk(root_directory): + for directory_path, directory_names, file_names in os.walk(root_directory): for file_name in file_names: file_full_path = os.path.join(directory_path, file_name) @@ -1006,7 +1006,7 @@ def inner_extract_dictionary_secrets( extracted_secrets: Set[str] = set() if dictionary: - for (key, value) in dictionary.items(): + for key, value in dictionary.items(): if isinstance(value, dict): if key == "secrets": extracted_secrets = ( diff --git a/setup.cfg b/setup.cfg index 33fda483..8d8788d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = schemachange -version = 3.6.1 +version = 3.6.2 description = A Database Change Management tool for Snowflake long_description = file: README.md long_description_content_type = text/markdown diff --git a/tests/test_cli_misc.py b/tests/test_cli_misc.py index b5dd2e75..ff466850 100644 --- a/tests/test_cli_misc.py +++ b/tests/test_cli_misc.py @@ -2,8 +2,8 @@ import pytest -def test_cli_given__schemachange_version_change(): - assert schemachange.cli._schemachange_version == "3.6.1" +def test_cli_given__schemachange_version_change_updated_in_setup_config_file(): + assert schemachange.cli._schemachange_version == "3.6.2" def test_cli_given__constants_exist(): @@ -123,12 +123,11 @@ def test_get_change_history_table_details_given__acceptable_values_produces_full ): assert schemachange.cli.get_change_history_table_details(cht) == expected + @pytest.mark.parametrize( "cht", [("fifth.fourth.third.two.one"), ("fourth.third.two.one")] ) -def test_get_change_history_table_details_given__unacceptable_values_raises_error( - cht -): +def test_get_change_history_table_details_given__unacceptable_values_raises_error(cht): with pytest.raises(ValueError) as e: schemachange.cli.get_change_history_table_details(cht)