Skip to content

Commit

Permalink
add files to branch
Browse files Browse the repository at this point in the history
Add support for directory in upper case
  • Loading branch information
sfc-gh-jvasquezrojas committed Aug 26, 2024
1 parent 286ce20 commit 7c6a495
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* Fix error handling and improve messaging when no artifacts provided.
* Improved error message for incompatible parameters.
* Fixed SQL error when running `snow app version create` and `snow app version drop` with a version name that isn't a valid Snowflake unquoted identifier

* Fixed git execute is not working with upper case in directory name.

# v2.8.0
## Backward incompatibility
Expand Down
6 changes: 4 additions & 2 deletions src/snowflake/cli/_plugins/stage/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ def _filter_files_list(
stage_path = stage_path_parts.path.lower()

# Exact file path was provided if stage_path in file list
if stage_path in files_on_stage:
filtered_files = self._filter_supported_files([stage_path])
for file in files_on_stage:
if file.lower() != stage_path:
continue
filtered_files = self._filter_supported_files([file])
if filtered_files:
return filtered_files
else:
Expand Down
9 changes: 9 additions & 0 deletions tests_integration/__snapshots__/test_git.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@
}),
])
# ---
# name: test_execute_with_name_in_camel_case
list([
dict({
'Error': None,
'File': '@SNOWCLI_TESTING_REPO/branches/main/tests_integration/test_data/projects/stage_execute/ScriptInCamelCase.sql',
'Status': 'SUCCESS',
}),
])
# ---
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select 'ScriptInCamelCase.sql';
17 changes: 17 additions & 0 deletions tests_integration/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,23 @@ def test_execute(runner, test_database, sf_git_repository, snapshot):
assert result.json == snapshot


@pytest.mark.skip(reason="This will be enabled in following PR")
@pytest.mark.integration
def test_execute_with_name_in_pascal_case(
runner, test_database, sf_git_repository, snapshot
):
result = runner.invoke_with_connection_json(
[
"git",
"execute",
f"@{sf_git_repository}/branches/main/tests_integration/test_data/projects/stage_execute/ScriptInPascalCase.sql",
]
)

assert result.exit_code == 0
assert result.json == snapshot


@pytest.mark.integration
def test_execute_fqn_repo(runner, test_database, sf_git_repository):
result_fqn = runner.invoke_with_connection_json(
Expand Down
4 changes: 3 additions & 1 deletion tests_integration/test_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ def test_create_error_schema_not_exist(runner, test_database):
@mock.patch.dict(os.environ, os.environ, clear=True)
def test_create_error_undefined_database(runner):
# undefined database
del os.environ["SNOWFLAKE_CONNECTIONS_INTEGRATION_DATABASE"]
database_environment_variable = "SNOWFLAKE_CONNECTIONS_INTEGRATION_DATABASE"
if database_environment_variable in os.environ:
del os.environ[database_environment_variable]

result = runner.invoke_with_connection(
["object", "create", "schema", f"name=test_schema"]
Expand Down

0 comments on commit 7c6a495

Please sign in to comment.