Skip to content

Commit

Permalink
Merge pull request #247 from Snowflake-Labs/feature/add_identifier_fu…
Browse files Browse the repository at this point in the history
…nction_to_SQL_calls

3.6.2 release contents
  • Loading branch information
sfc-gh-tmathew authored Apr 13, 2024
2 parents ad4d75e + 543faf9 commit 67fad54
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion .github/workflows/dev-pytest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pytest
name: dev-pytest

on:
push:
Expand All @@ -8,6 +8,8 @@ on:
pull_request:
types: [opened, reopened]

workflow_dispatch:

jobs:
build:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pytest
name: master-pytest

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 9 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ requires = [
"setuptools >= 40.9.0",
"wheel",
]
build-backend = "setuptools.build_meta"
build-backend = "setuptools.build_meta"
14 changes: 7 additions & 7 deletions schemachange/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions tests/test_cli_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 67fad54

Please sign in to comment.