diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 08154e86de..05528ae455 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -23,6 +23,7 @@ ## Fixes and improvements * Fixed `SELECT *` output being corrupted when joined tables share column names. Duplicate column names are now disambiguated by appending a numeric suffix (e.g. `NAME`, `NAME_2`). * Fixed `snow connection generate-jwt` and `snow connection generate-workload-identity-token` failing with `Connection None is not configured` when used with `--temporary-connection`. +* `snow dcm list-deployments` and `snow dcm drop-deployment` now wrap the project name in `IDENTIFIER(...)`, matching every other DCM subcommand. Fully-qualified and quoted project names are now handled consistently. # v3.17.0 diff --git a/src/snowflake/cli/_plugins/dcm/manager.py b/src/snowflake/cli/_plugins/dcm/manager.py index 526034c2fb..4ed013af7a 100644 --- a/src/snowflake/cli/_plugins/dcm/manager.py +++ b/src/snowflake/cli/_plugins/dcm/manager.py @@ -148,7 +148,7 @@ def list_deployments(self, project_identifier: FQN) -> SnowflakeCursor: "Running DCM list-deployments manager operation (project_identifier=%s).", project_identifier, ) - query = f"SHOW DEPLOYMENTS IN DCM PROJECT {project_identifier.identifier}" + query = f"SHOW DEPLOYMENTS IN DCM PROJECT {project_identifier.sql_identifier}" return self.execute_query(query=query) def drop_deployment( @@ -165,7 +165,7 @@ def drop_deployment( project_identifier, if_exists, ) - query = f"ALTER DCM PROJECT {project_identifier.identifier} DROP DEPLOYMENT" + query = f"ALTER DCM PROJECT {project_identifier.sql_identifier} DROP DEPLOYMENT" if if_exists: query += " IF EXISTS" query += f' "{deployment_name}"' diff --git a/tests/dcm/test_manager.py b/tests/dcm/test_manager.py index dfb64aa2fa..6943a5008c 100644 --- a/tests/dcm/test_manager.py +++ b/tests/dcm/test_manager.py @@ -327,7 +327,7 @@ def test_list_deployments(mock_execute_query): mgr.list_deployments(project_identifier=TEST_PROJECT) mock_execute_query.assert_called_once_with( - query="SHOW DEPLOYMENTS IN DCM PROJECT my_project" + query="SHOW DEPLOYMENTS IN DCM PROJECT IDENTIFIER('my_project')" ) @@ -339,7 +339,7 @@ def test_drop_deployment(mock_execute_query, if_exists): project_identifier=TEST_PROJECT, deployment_name="v1", if_exists=if_exists ) - expected_query = "ALTER DCM PROJECT my_project DROP DEPLOYMENT" + expected_query = "ALTER DCM PROJECT IDENTIFIER('my_project') DROP DEPLOYMENT" if if_exists: expected_query += " IF EXISTS" expected_query += ' "v1"'