Skip to content

Commit

Permalink
Show connection name if not specified in test command (#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-turbaszek authored Jul 12, 2024
1 parent 89660c9 commit f6868e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/snowflake/cli/app/snow_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@

import snowflake.connector
from click.exceptions import ClickException
from snowflake.cli.api.config import get_connection_dict, get_default_connection_dict
from snowflake.cli.api.cli_global_context import cli_context
from snowflake.cli.api.config import (
get_connection_dict,
get_default_connection_dict,
get_default_connection_name,
)
from snowflake.cli.api.constants import DEFAULT_SIZE_LIMIT_MB
from snowflake.cli.api.exceptions import (
InvalidConnectionConfiguration,
Expand Down Expand Up @@ -70,6 +75,9 @@ def connect_to_snowflake(
connection_parameters = {} # we will apply overrides in next step
else:
connection_parameters = get_default_connection_dict()
cli_context.connection_context.set_connection_name(
get_default_connection_name()
)

# Apply overrides to connection details
for key, value in overrides.items():
Expand Down
1 change: 1 addition & 0 deletions tests_integration/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
def test_connection_test_simple(runner):
result = runner.invoke_with_connection_json(["connection", "test"])
assert result.exit_code == 0, result.output
assert result.json["Connection name"] == "integration"
assert result.json["Status"] == "OK"


Expand Down

0 comments on commit f6868e5

Please sign in to comment.