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

Fix/make get scripts case insensitive #313

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/dev-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
echo "GITHUB WORKSPACE: ${GITHUB_WORKSPACE}"
chmod +x testSchemachange.sh
bash testSchemachange.sh
working-directory: .
working-directory: .
2 changes: 1 addition & 1 deletion populateConnection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ echo warehouse = \"${SNOWFLAKE_WAREHOUSE}\" >> ./connections.toml
echo database = \"${SNOWFLAKE_DATABASE}\" >> ./connections.toml
echo password = \"${SNOWFLAKE_PASSWORD}\" >> ./connections.toml
echo "cat connections.toml"
cat ./connections.toml
cat ./connections.toml
2 changes: 1 addition & 1 deletion schemachange/config/ChangeHistoryTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ChangeHistoryTable:
@property
def fully_qualified(self) -> str:
return f"{self.database_name}.{self.schema_name}.{self.table_name}"

@property
def fully_qualified_schema_name(self) -> str:
return f"{self.database_name}.{self.schema_name}"
Expand Down
10 changes: 5 additions & 5 deletions schemachange/config/DeployConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from schemachange.config.ChangeHistoryTable import ChangeHistoryTable
from schemachange.config.utils import (
get_snowflake_identifier_string,
get_snowflake_password,
)


@dataclasses.dataclass(frozen=True)
class DeployConfig(BaseConfig):
subcommand: Literal["deploy"] = "deploy"
Expand Down Expand Up @@ -84,12 +84,12 @@ def get_session_kwargs(self) -> dict:
"connection_name": self.connection_name,
"change_history_table": self.change_history_table,
"autocommit": self.autocommit,
"query_tag": self.query_tag
"query_tag": self.query_tag,
}
# TODO: Discuss the need for check for snowflake password before passing the session

# TODO: Discuss the need for check for snowflake password before passing the session
# kwargs to open a snowflake session
# snowflake_password = get_snowflake_password()
# if snowflake_password is not None and snowflake_password:
# session_kwargs["password"] = snowflake_password
# session_kwargs["password"] = snowflake_password
return {k: v for k, v in session_kwargs.items() if v is not None}
2 changes: 1 addition & 1 deletion schemachange/config/get_merged_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from schemachange.config.utils import (
load_yaml_config,
validate_directory,
validate_file_path
validate_file_path,
)


Expand Down
11 changes: 6 additions & 5 deletions schemachange/session/Script.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import dataclasses
import itertools
import re
from abc import ABC
from pathlib import Path
Expand Down Expand Up @@ -99,11 +98,13 @@ def get_all_scripts_recursively(root_directory: Path):
all_files: dict[str, T] = dict()
all_versions = list()
# Walk the entire directory structure recursively
file_paths = itertools.chain(
root_directory.rglob("*.sql"), root_directory.rglob("*.sql.jinja")
)

sql_pattern = re.compile(r"\.sql(\.jinja)?$", flags=re.IGNORECASE)
file_paths = root_directory.glob("**/*")
for file_path in file_paths:
if file_path.is_dir():
continue
if not sql_pattern.search(file_path.name.strip()):
continue
script = script_factory(file_path=file_path)
if script is None:
continue
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ dev =
black
flake8
pre-commit
pyfakefs
pytest
Loading