diff --git a/src/snowflake/cli/_plugins/nativeapp/run_processor.py b/src/snowflake/cli/_plugins/nativeapp/run_processor.py index 77439d99a4..f74ea9bd2a 100644 --- a/src/snowflake/cli/_plugins/nativeapp/run_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/run_processor.py @@ -72,6 +72,19 @@ } +def print_warnings(create_or_upgrade_cursor: DictCursor): + """ + Shows warnings in the console returned by the CREATE or UPGRADE + APPLICATION command. + """ + messages = [row["status"] for row in create_or_upgrade_cursor.fetchall()] + warnings = [m for m in messages if m.lower().startswith("warning:")] + if warnings: + for warning in warnings: + cc.warning(warning) + cc.message("") + + class SameAccountInstallMethod: _requires_created_by_cli: bool _from_release_directive: bool @@ -252,9 +265,11 @@ def create_or_upgrade_app( f"Upgrading existing application object {self.app_name}." ) using_clause = install_method.using_clause(self._na_project) - self._execute_query( - f"alter application {self.app_name} upgrade {using_clause}" + upgrade_cursor = self._execute_query( + f"alter application {self.app_name} upgrade {using_clause}", + cursor_class=DictCursor, ) + print_warnings(upgrade_cursor) if install_method.is_dev_mode: # if debug_mode is present (controlled), ensure it is up-to-date @@ -300,15 +315,17 @@ def create_or_upgrade_app( debug_mode_clause = f"debug_mode = {initial_debug_mode}" using_clause = install_method.using_clause(self._na_project) - self._execute_query( + create_cursor = self._execute_query( dedent( f"""\ create application {self.app_name} from application package {self.package_name} {using_clause} {debug_mode_clause} comment = {SPECIAL_COMMENT} """ - ) + ), + cursor_class=DictCursor, ) + print_warnings(create_cursor) # hooks always executed after a create or upgrade self.execute_app_post_deploy_hooks()