diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d1cba58a63..6b812e54d9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -16,6 +16,16 @@ # Unreleased version ## Backward incompatibility + +## Deprecations + +## New additions + +## Fixes and improvements + + +# v3.0.0 +## Backward incompatibility * Dropped support for Python below 3.10 version. * `snow object stage` commands are removed in favour of `snow stage`. * `snow snowpark init` and `snow streamlit init` commands are removed in favor of `snow init` command. @@ -27,6 +37,7 @@ * `snow snowpark deploy` uploads all artifacts created during build step. Dependencies zip is upload once to every Snowpark stage specified in project definition. * The changes are compatible with V1 projects definition though the result state (file layout) is different. + * `snow snowpark package` commands no longer fallback to Anaconda Channel metadata when fetching available packages info fails. ## Deprecations @@ -36,6 +47,7 @@ * Added support for external access (api integrations and secrets) in Streamlit. * Added support for `<% ... %>` syntax in SQL templating. * Support multiple Streamlit application in single snowflake.yml project definition file. +* Added `snow ws migrate` command to migrate `snowflake.yml` file from V1 to V2. ## Fixes and improvements * Fixed problem with whitespaces in `snow connection add` command. diff --git a/src/snowflake/cli/_app/dev/docs/commands_docs_generator.py b/src/snowflake/cli/_app/dev/docs/commands_docs_generator.py index 21e5d19d13..14a2873c35 100644 --- a/src/snowflake/cli/_app/dev/docs/commands_docs_generator.py +++ b/src/snowflake/cli/_app/dev/docs/commands_docs_generator.py @@ -15,7 +15,7 @@ from __future__ import annotations import logging -from typing import List, Optional +from typing import Any, List, Optional from click import Command from snowflake.cli._app.dev.docs.template_utils import get_template_environment @@ -86,15 +86,33 @@ def _render_command_usage( # Included files, which these are, need to use the .txt extension. file_path = root / f"usage-{command_name}.txt" log.info("Creating %s", file_path) + command_help_params = _split_docstring(command.help) + template_params = { + "name": command_name, + "options": options, + "arguments": arguments, + "path": path, + } with file_path.open("w+") as fh: - fh.write( - template.render( - { - "help": command.help, - "name": command_name, - "options": options, - "arguments": arguments, - "path": path, - } - ) + fh.write(template.render(command_help_params | template_params)) + + +def _split_docstring(command_help: Optional[str]) -> dict[str, Any]: + if command_help is None: + return {} + + split_command_help = command_help.split("## ") + + if len(split_command_help) == 1: + return {"help": split_command_help[0]} + + additional_sections = [] + for section in split_command_help[1:]: + lines = section.split("\n") + additional_sections.append( + {"title": lines[0], "content": "\n".join(lines[1:]).strip()} ) + return { + "help": split_command_help[0], + "additional_sections": additional_sections, + } diff --git a/src/snowflake/cli/_app/dev/docs/templates/usage.rst.jinja2 b/src/snowflake/cli/_app/dev/docs/templates/usage.rst.jinja2 index d9bd7521c2..3a42a35a67 100644 --- a/src/snowflake/cli/_app/dev/docs/templates/usage.rst.jinja2 +++ b/src/snowflake/cli/_app/dev/docs/templates/usage.rst.jinja2 @@ -1,4 +1,4 @@ -{{ help | replace("`", "``") }} +{{ help | replace("`", "``") | replace("\n", " ") }} Syntax =============================================================================== @@ -26,7 +26,7 @@ Arguments {{ param.make_metavar().replace("[", "").replace("]", "").lower() }} {%- endif -%} {{ '}' }}` -{% if param.help %}{{ " " + param.help | replace("`", "``") }}{% if param.help[-1] != '.' %}.{% endif %}{% if param.default %} Default: {{ param.default }}.{% endif %}{% else %} TBD{% endif %} +{% if param.help %}{{ " " + param.help | replace("`", "``") | replace("\n", " ") }}{% if param.help[-1] != '.' %}.{% endif %}{% if param.default %} Default: {{ param.default }}.{% endif %}{% else %} TBD{% endif %} {% endfor %} {% else %} @@ -48,10 +48,20 @@ Options {%- if param.type.name != "choice" %}{{ ' {' }}{% else %} {% endif %}{{ param.make_metavar() }}{% if param.type.name != "choice" %}{{ '}' }} {%- endif %} {%- endif %}` -{% if param.help %}{{ " " + param.help | replace("`", "``") }}{% if param.help[-1] != '.' %}.{% endif %}{% if param.default is not none %} Default: {{ param.default }}.{% endif %}{% else %} TBD{% endif %} -{% endfor %} +{% if param.help %}{{ " " + param.help | replace("`", "``") | replace("\n", " ") }}{% if param.help[-1] != '.' %}.{% endif %}{% if param.default is not none %} Default: {{ param.default }}.{% endif %}{% else %} TBD{% endif %} +{% endfor -%} {% else %} None {% endif -%} + +{%- if additional_sections %} +.. +{%- for section in additional_sections %} + {{ section.title }} + =============================================================================== + + {{ section.content | indent(2) }} +{% endfor %} +{% endif %} diff --git a/src/snowflake/cli/_plugins/git/commands.py b/src/snowflake/cli/_plugins/git/commands.py index 36cb770b73..b7c43af9d3 100644 --- a/src/snowflake/cli/_plugins/git/commands.py +++ b/src/snowflake/cli/_plugins/git/commands.py @@ -106,6 +106,8 @@ def setup( """ Sets up a git repository object. + ## Usage notes + You will be prompted for: * url - address of repository to be used for git clone operation diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py b/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py index 4f9cffabcd..72e677ca3a 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/compiler.py @@ -14,6 +14,8 @@ from __future__ import annotations +import copy +import re from typing import Dict, Optional from snowflake.cli._plugins.nativeapp.bundle_context import BundleContext @@ -34,7 +36,7 @@ ) SNOWPARK_PROCESSOR = "snowpark" -NA_SETUP_PROCESSOR = "native-app-setup" +NA_SETUP_PROCESSOR = "native app setup" _REGISTERED_PROCESSORS_BY_NAME = { SNOWPARK_PROCESSOR: SnowparkAnnotationProcessor, @@ -110,7 +112,15 @@ def _try_create_processor( # No registered processor with the specified name return None - current_processor = processor_factory(self._bundle_ctx) + processor_ctx = copy.copy(self._bundle_ctx) + processor_subdirectory = re.sub(r"[^a-zA-Z0-9_$]", "_", processor_name) + processor_ctx.bundle_root = ( + self._bundle_ctx.bundle_root / processor_subdirectory + ) + processor_ctx.generated_root = ( + self._bundle_ctx.generated_root / processor_subdirectory + ) + current_processor = processor_factory(processor_ctx) self.cached_processors[processor_name] = current_processor return current_processor diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py index 4ca214d381..fc80246622 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py @@ -15,12 +15,18 @@ from __future__ import annotations import json +import logging import os.path from pathlib import Path from typing import List, Optional +import yaml from click import ClickException -from snowflake.cli._plugins.nativeapp.artifacts import BundleMap, find_setup_script_file +from snowflake.cli._plugins.nativeapp.artifacts import ( + BundleMap, + find_manifest_file, + find_setup_script_file, +) from snowflake.cli._plugins.nativeapp.codegen.artifact_processor import ( ArtifactProcessor, is_python_file_artifact, @@ -40,6 +46,32 @@ DEFAULT_TIMEOUT = 30 DRIVER_PATH = Path(__file__).parent / "setup_driver.py.source" +log = logging.getLogger(__name__) + + +def safe_set(d: dict, *keys: str, **kwargs) -> None: + """ + Sets a value in a nested dictionary structure, creating intermediate dictionaries as needed. + Sample usage: + + d = {} + safe_set(d, "a", "b", "c", value=42) + + d is now: + { + "a": { + "b": { + "c": 42 + } + } + } + """ + curr = d + for k in keys[:-1]: + curr = curr.setdefault(k, {}) + + curr[keys[-1]] = kwargs.get("value") + class NativeAppSetupProcessor(ArtifactProcessor): def __init__(self, *args, **kwargs): @@ -73,18 +105,55 @@ def process( ) files_to_process.append(src_file) - sql_files_mapping = self._execute_in_sandbox(files_to_process) - self._generate_setup_sql(sql_files_mapping) + result = self._execute_in_sandbox(files_to_process) + if not result: + return # nothing to do + + logs = result.get("logs", []) + for msg in logs: + log.debug(msg) + + warnings = result.get("warnings", []) + for msg in warnings: + cc.warning(msg) + + schema_version = result.get("schema_version") + if schema_version != "1": + raise ClickException( + f"Unsupported schema version returned from snowflake-app-python library: {schema_version}" + ) + + setup_script_mods = [ + mod + for mod in result.get("modifications", []) + if mod.get("target") == "native_app:setup_script" + ] + if setup_script_mods: + self._edit_setup_sql(setup_script_mods) + + manifest_mods = [ + mod + for mod in result.get("modifications", []) + if mod.get("target") == "native_app:manifest" + ] + if manifest_mods: + self._edit_manifest(manifest_mods) def _execute_in_sandbox(self, py_files: List[Path]) -> dict: file_count = len(py_files) cc.step(f"Processing {file_count} setup file{'s' if file_count > 1 else ''}") + manifest_path = find_manifest_file(deploy_root=self._bundle_ctx.deploy_root) + + generated_root = self._bundle_ctx.generated_root + generated_root.mkdir(exist_ok=True, parents=True) + env_vars = { "_SNOWFLAKE_CLI_PROJECT_PATH": str(self._bundle_ctx.project_root), "_SNOWFLAKE_CLI_SETUP_FILES": os.pathsep.join(map(str, py_files)), "_SNOWFLAKE_CLI_APP_NAME": str(self._bundle_ctx.package_name), - "_SNOWFLAKE_CLI_SQL_DEST_DIR": str(self.generated_root), + "_SNOWFLAKE_CLI_SQL_DEST_DIR": str(generated_root), + "_SNOWFLAKE_CLI_MANIFEST_PATH": str(manifest_path), } try: @@ -102,56 +171,68 @@ def _execute_in_sandbox(self, py_files: List[Path]) -> dict: ) if result.returncode == 0: - sql_file_mappings = json.loads(result.stdout) - return sql_file_mappings + return json.loads(result.stdout) else: raise ClickException( f"Failed to execute python setup script logic: {result.stderr}" ) - def _generate_setup_sql(self, sql_file_mappings: dict) -> None: - if not sql_file_mappings: - # Nothing to generate - return - - generated_root = self.generated_root - generated_root.mkdir(exist_ok=True, parents=True) - + def _edit_setup_sql(self, modifications: List[dict]) -> None: cc.step("Patching setup script") setup_file_path = find_setup_script_file( deploy_root=self._bundle_ctx.deploy_root ) - with self.edit_file(setup_file_path) as f: - new_contents = [f.contents] - if sql_file_mappings["schemas"]: - schemas_file = generated_root / sql_file_mappings["schemas"] - new_contents.insert( - 0, - f"EXECUTE IMMEDIATE FROM '/{to_stage_path(schemas_file.relative_to(self._bundle_ctx.deploy_root))}';", - ) - - if sql_file_mappings["compute_pools"]: - compute_pools_file = generated_root / sql_file_mappings["compute_pools"] - new_contents.append( - f"EXECUTE IMMEDIATE FROM '/{to_stage_path(compute_pools_file.relative_to(self._bundle_ctx.deploy_root))}';" - ) - - if sql_file_mappings["services"]: - services_file = generated_root / sql_file_mappings["services"] - new_contents.append( - f"EXECUTE IMMEDIATE FROM '/{to_stage_path(services_file.relative_to(self._bundle_ctx.deploy_root))}';" - ) - - f.edited_contents = "\n".join(new_contents) + with self.edit_file(setup_file_path) as f: + prepended = [] + appended = [] + + for mod in modifications: + for inst in mod.get("instructions", []): + if inst.get("type") == "insert": + default_loc = inst.get("default_location") + if default_loc == "end": + appended.append(self._setup_mod_instruction_to_sql(inst)) + elif default_loc == "start": + prepended.append(self._setup_mod_instruction_to_sql(inst)) + + if prepended or appended: + f.edited_contents = "\n".join(prepended + [f.contents] + appended) + + def _edit_manifest(self, modifications: List[dict]) -> None: + cc.step("Patching manifest") + manifest_path = find_manifest_file(deploy_root=self._bundle_ctx.deploy_root) + + with self.edit_file(manifest_path) as f: + manifest = yaml.safe_load(f.contents) + + for mod in modifications: + for inst in mod.get("instructions", []): + if inst.get("type") == "set": + payload = inst.get("payload") + if payload: + key = payload.get("key") + value = payload.get("value") + safe_set(manifest, *key.split("."), value=value) + f.edited_contents = yaml.safe_dump(manifest, sort_keys=False) + + def _setup_mod_instruction_to_sql(self, mod_inst: dict) -> str: + payload = mod_inst.get("payload") + if not payload: + raise ClickException("Unsupported instruction received: no payload found") + + payload_type = payload.get("type") + if payload_type == "execute immediate": + file_path = payload.get("file_path") + if file_path: + sql_file_path = self._bundle_ctx.generated_root / file_path + return f"EXECUTE IMMEDIATE FROM '/{to_stage_path(sql_file_path.relative_to(self._bundle_ctx.deploy_root))}';" + + raise ClickException(f"Unsupported instruction type received: {payload_type}") @property def sandbox_root(self): - return self._bundle_ctx.bundle_root / "setup_py_venv" - - @property - def generated_root(self): - return self._bundle_ctx.generated_root / "setup_py" + return self._bundle_ctx.bundle_root / "venv" def _create_or_update_sandbox(self): sandbox_root = self.sandbox_root diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/setup_driver.py.source b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/setup_driver.py.source index 4a261cbf1e..b340ca287a 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/setup/setup_driver.py.source +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/setup/setup_driver.py.source @@ -20,8 +20,11 @@ from pathlib import Path import snowflake.app.context as ctx from snowflake.app.sql import SQLGenerator -ctx._project_path = os.environ["_SNOWFLAKE_CLI_PROJECT_PATH"] -ctx._current_app_name = os.environ["_SNOWFLAKE_CLI_APP_NAME"] +ctx.configure("project_path", os.environ.get("_SNOWFLAKE_CLI_PROJECT_PATH", None)) +ctx.configure("manifest_path", os.environ.get("_SNOWFLAKE_CLI_MANIFEST_PATH", None)) +ctx.configure("current_app_name", os.environ.get("_SNOWFLAKE_CLI_APP_NAME", None)) +ctx.configure("enable_sql_generation", True) + __snowflake_internal_py_files = os.environ["_SNOWFLAKE_CLI_SETUP_FILES"].split( os.pathsep ) diff --git a/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py b/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py index 7eab90dd4e..e26e1b1c26 100644 --- a/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py +++ b/src/snowflake/cli/_plugins/nativeapp/codegen/snowpark/python_processor.py @@ -226,13 +226,9 @@ def process( edit_setup_script_with_exec_imm_sql( collected_sql_files=collected_sql_files, deploy_root=bundle_map.deploy_root(), - generated_root=self._generated_root, + generated_root=self._bundle_ctx.generated_root, ) - @property - def _generated_root(self): - return self._bundle_ctx.generated_root / "snowpark" - def _normalize_imports( self, extension_fn: NativeAppExtensionFunction, @@ -366,7 +362,9 @@ def generate_new_sql_file_name(self, py_file: Path) -> Path: Generates a SQL filename for the generated root from the python file, and creates its parent directories. """ relative_py_file = py_file.relative_to(self._bundle_ctx.deploy_root) - sql_file = Path(self._generated_root, relative_py_file.with_suffix(".sql")) + sql_file = Path( + self._bundle_ctx.generated_root, relative_py_file.with_suffix(".sql") + ) if sql_file.exists(): cc.warning( f"""\ diff --git a/src/snowflake/cli/_plugins/snowpark/commands.py b/src/snowflake/cli/_plugins/snowpark/commands.py index 8d7c3b5ca2..e503baabaa 100644 --- a/src/snowflake/cli/_plugins/snowpark/commands.py +++ b/src/snowflake/cli/_plugins/snowpark/commands.py @@ -141,11 +141,8 @@ def deploy( pd = _get_v2_project_definition(cli_context) snowpark_entities = get_snowpark_entities(pd) - project_name = ( - pd.defaults.project_name if pd.defaults and pd.defaults.project_name else "" - ) project_paths = SnowparkProjectPaths( - project_root=cli_context.project_root, project_name=project_name + project_root=cli_context.project_root, ) with cli_console.phase("Performing initial validation"): @@ -231,7 +228,7 @@ def build_artifacts_mappings( stages_to_artifact_map[stage].update(required_artifacts) if project_paths.dependencies.exists(): - deps_artefact = project_paths.get_artefact_dto(project_paths.dependencies) + deps_artefact = project_paths.get_dependencies_artefact() stages_to_artifact_map[stage].add(deps_artefact) entities_to_imports_map[entity_id].add(deps_artefact.import_path(stage)) return entities_to_imports_map, stages_to_artifact_map @@ -324,7 +321,7 @@ def build( pd = _get_v2_project_definition(cli_context) project_paths = SnowparkProjectPaths( - project_root=cli_context.project_root, project_name=None + project_root=cli_context.project_root, ) anaconda_packages_manager = AnacondaPackagesManager() @@ -448,31 +445,43 @@ def describe( ) -def _migrate_v1_snowpark_to_v2(pd: ProjectDefinition): +def migrate_v1_snowpark_to_v2(pd: ProjectDefinition): if not pd.snowpark: raise NoProjectDefinitionError( project_type="snowpark", project_root=get_cli_context().project_root ) + artifact_mapping = {"src": pd.snowpark.src} + if pd.snowpark.project_name: + artifact_mapping["dest"] = pd.snowpark.project_name + + snowpark_shared_mixin = "snowpark_shared" data: dict = { "definition_version": "2", - "defaults": { - "stage": pd.snowpark.stage_name, - "project_name": pd.snowpark.project_name, + "mixins": { + snowpark_shared_mixin: { + "stage": pd.snowpark.stage_name, + "artifacts": [artifact_mapping], + } }, "entities": {}, } - for entity in [*pd.snowpark.procedures, *pd.snowpark.functions]: + for index, entity in enumerate([*pd.snowpark.procedures, *pd.snowpark.functions]): identifier = {"name": entity.name} if entity.database is not None: identifier["database"] = entity.database if entity.schema_name is not None: identifier["schema"] = entity.schema_name + + if entity.name.startswith("<%") and entity.name.endswith("%>"): + entity_name = f"snowpark_entity_{index}" + else: + entity_name = entity.name + v2_entity = { "type": "function" if isinstance(entity, FunctionSchema) else "procedure", "stage": pd.snowpark.stage_name, - "artifacts": [pd.snowpark.src], "handler": entity.handler, "returns": entity.returns, "signature": entity.signature, @@ -481,11 +490,15 @@ def _migrate_v1_snowpark_to_v2(pd: ProjectDefinition): "secrets": entity.secrets, "imports": entity.imports, "identifier": identifier, + "meta": {"use_mixins": [snowpark_shared_mixin]}, } if isinstance(entity, ProcedureSchema): v2_entity["execute_as_caller"] = entity.execute_as_caller - data["entities"][entity.name] = v2_entity + data["entities"][entity_name] = v2_entity + + if hasattr(pd, "env") and pd.env: + data["env"] = {k: v for k, v in pd.env.items()} return ProjectDefinitionV2(**data) @@ -493,5 +506,5 @@ def _migrate_v1_snowpark_to_v2(pd: ProjectDefinition): def _get_v2_project_definition(cli_context) -> ProjectDefinitionV2: pd = cli_context.project_definition if not pd.meets_version_requirement("2"): - pd = _migrate_v1_snowpark_to_v2(pd) + pd = migrate_v1_snowpark_to_v2(pd) return pd diff --git a/src/snowflake/cli/_plugins/snowpark/package/anaconda_packages.py b/src/snowflake/cli/_plugins/snowpark/package/anaconda_packages.py index 19df4ba1ff..36a7eeeae2 100644 --- a/src/snowflake/cli/_plugins/snowpark/package/anaconda_packages.py +++ b/src/snowflake/cli/_plugins/snowpark/package/anaconda_packages.py @@ -18,12 +18,9 @@ from dataclasses import dataclass from typing import Dict, List, Set -import requests -from click import ClickException from packaging.requirements import InvalidRequirement from packaging.requirements import Requirement as PkgRequirement from packaging.version import InvalidVersion, parse -from requests import HTTPError from snowflake.cli._plugins.snowpark.models import Requirement from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError from snowflake.cli.api.secure_path import SecurePath @@ -170,23 +167,13 @@ class AnacondaPackagesManager(SqlExecutionMixin): "https://repo.anaconda.com/pkgs/snowflake/channeldata.json" ) - # TODO in v3.0: Keep only SQL query, remove fallback to JSON with channel's metadata def find_packages_available_in_snowflake_anaconda(self) -> AnacondaPackages: """ Finds python packages available in Snowflake to use in functions and stored procedures. It tries to get the list of packages using SQL query but if the try fails then the fallback is to parse JSON containing info about Snowflake's Anaconda channel. """ - try: - packages = self._query_snowflake_for_available_packages() - except Exception as ex: - log.warning( - "Cannot fetch available packages information from Snowflake. " - "Please check your connection configuration. " - "Fallback to Anaconda channel metadata." - ) - log.debug("Available packages query failure: %s", ex.__str__(), exc_info=ex) - packages = self._get_available_packages_from_anaconda_channel_info() + packages = self._query_snowflake_for_available_packages() return AnacondaPackages(packages) def _query_snowflake_for_available_packages(self) -> dict[str, AvailablePackage]: @@ -210,24 +197,3 @@ def _query_snowflake_for_available_packages(self) -> dict[str, AvailablePackage] snowflake_name=package_name, versions={version} ) return packages - - def _get_available_packages_from_anaconda_channel_info( - self, - ) -> dict[str, AvailablePackage]: - try: - response = requests.get(self._snowflake_channel_url) - response.raise_for_status() - packages = {} - for key, package in response.json()["packages"].items(): - if not (version := package.get("version")): - continue - package_name = package.get("name", key) - standardized_name = Requirement.standardize_name(package_name) - packages[standardized_name] = AvailablePackage( - snowflake_name=package_name, versions={version} - ) - return packages - except HTTPError as err: - raise ClickException( - f"Accessing Snowflake Anaconda channel failed. Reason {err}" - ) diff --git a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py index 23392336fb..8949012a4a 100644 --- a/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +++ b/src/snowflake/cli/_plugins/snowpark/snowpark_project_paths.py @@ -14,12 +14,13 @@ from __future__ import annotations from dataclasses import dataclass -from pathlib import Path +from pathlib import Path, PurePosixPath from snowflake.cli._plugins.snowpark.zipper import zip_dir from snowflake.cli.api.console import cli_console from snowflake.cli.api.constants import DEPLOYMENT_STAGE from snowflake.cli.api.identifiers import FQN +from snowflake.cli.api.project.schemas.entities.snowpark_entity import PathMapping from snowflake.cli.api.secure_path import SecurePath @@ -30,19 +31,21 @@ class SnowparkProjectPaths: """ project_root: Path - project_name: str | None = None def path_relative_to_root(self, artifact_path: Path) -> Path: if artifact_path.is_absolute(): return artifact_path return (self.project_root / artifact_path).resolve() - def get_artefact_dto(self, artifact_path: Path) -> Artefact: + def get_artefact_dto(self, artifact_path: PathMapping) -> Artefact: return Artefact( - project_name=self.project_name, - path=self.path_relative_to_root(artifact_path), + dest=artifact_path.dest, + path=self.path_relative_to_root(artifact_path.src), ) + def get_dependencies_artefact(self) -> Artefact: + return Artefact(dest=None, path=self.dependencies) + @property def snowflake_requirements(self) -> SecurePath: return SecurePath( @@ -63,7 +66,7 @@ class Artefact: """Helper for getting paths related to given artefact.""" path: Path - project_name: str | None = None + dest: str | None = None @property def _artefact_name(self) -> str: @@ -86,10 +89,10 @@ def upload_path(self, stage: FQN | str | None) -> str: if isinstance(stage, str): stage = FQN.from_stage(stage).using_context() - artifact_stage_directory = f"@{stage}/" - if self.project_name: - artifact_stage_directory += f"{self.project_name}/" - return artifact_stage_directory + stage_path = PurePosixPath(f"@{stage}") + if self.dest: + stage_path = stage_path / self.dest + return str(stage_path) + "/" def import_path(self, stage: FQN | str | None) -> str: """Path for UDF/sproc imports clause.""" diff --git a/src/snowflake/cli/_plugins/streamlit/commands.py b/src/snowflake/cli/_plugins/streamlit/commands.py index 5bd30c24b4..a530b19317 100644 --- a/src/snowflake/cli/_plugins/streamlit/commands.py +++ b/src/snowflake/cli/_plugins/streamlit/commands.py @@ -139,7 +139,7 @@ def streamlit_deploy( raise NoProjectDefinitionError( project_type="streamlit", project_root=cli_context.project_root ) - pd = _migrate_v1_streamlit_to_v2(pd) + pd = migrate_v1_streamlit_to_v2(pd) streamlits: Dict[str, StreamlitEntityModel] = pd.get_entities_by_type( entity_type="streamlit" @@ -171,7 +171,7 @@ def streamlit_deploy( return MessageResult(f"Streamlit successfully deployed and available under {url}") -def _migrate_v1_streamlit_to_v2(pd: ProjectDefinition): +def migrate_v1_streamlit_to_v2(pd: ProjectDefinition): default_env_file = "environment.yml" default_pages_dir = "pages" @@ -204,10 +204,15 @@ def _migrate_v1_streamlit_to_v2(pd: ProjectDefinition): if pd.streamlit.database: identifier["database"] = pd.streamlit.database + if pd.streamlit.name.startswith("<%") and pd.streamlit.name.endswith("%>"): + streamlit_name = "streamlit_entity_1" + else: + streamlit_name = pd.streamlit.name + data = { "definition_version": "2", "entities": { - pd.streamlit.name: { + streamlit_name: { "type": "streamlit", "identifier": identifier, "title": pd.streamlit.title, @@ -219,6 +224,8 @@ def _migrate_v1_streamlit_to_v2(pd: ProjectDefinition): } }, } + if hasattr(pd, "env") and pd.env: + data["env"] = {k: v for k, v in pd.env.items()} return ProjectDefinitionV2(**data) diff --git a/src/snowflake/cli/_plugins/workspace/commands.py b/src/snowflake/cli/_plugins/workspace/commands.py index 17ffa5577a..3a225ef51f 100644 --- a/src/snowflake/cli/_plugins/workspace/commands.py +++ b/src/snowflake/cli/_plugins/workspace/commands.py @@ -14,23 +14,74 @@ from __future__ import annotations +import logging + import typer +import yaml +from click import ClickException from snowflake.cli._plugins.nativeapp.artifacts import BundleMap +from snowflake.cli._plugins.snowpark.commands import migrate_v1_snowpark_to_v2 +from snowflake.cli._plugins.streamlit.commands import migrate_v1_streamlit_to_v2 from snowflake.cli._plugins.workspace.manager import WorkspaceManager from snowflake.cli.api.cli_global_context import get_cli_context from snowflake.cli.api.commands.decorators import with_project_definition from snowflake.cli.api.commands.snow_typer import SnowTyper from snowflake.cli.api.entities.common import EntityActions from snowflake.cli.api.output.types import MessageResult +from snowflake.cli.api.project.definition_manager import DefinitionManager +from snowflake.cli.api.secure_path import SecurePath ws = SnowTyper( name="ws", - hidden=True, help="Deploy and interact with snowflake.yml-based entities.", ) +log = logging.getLogger(__name__) + + +@ws.command() +def migrate( + accept_templates: bool = typer.Option( + False, "-t", "--accept-templates", help="Allows the migration of templates." + ), + **options, +): + """Migrates the Snowpark and Streamlit project definition files form V1 to V2.""" + pd = DefinitionManager().unrendered_project_definition + + if pd.meets_version_requirement("2"): + return MessageResult("Project definition is already at version 2.") + + if "<% ctx." in str(pd): + if not accept_templates: + raise ClickException( + "Project definition contains templates. They may not be migrated correctly, and require manual migration." + "You can try again with --accept-templates option, to attempt automatic migration." + ) + log.warning( + "Your V1 definition contains templates. We cannot guarantee the correctness of the migration." + ) + + if pd.streamlit: + pd_v2 = migrate_v1_streamlit_to_v2(pd) + elif pd.snowpark: + pd_v2 = migrate_v1_snowpark_to_v2(pd) + else: + raise ValueError( + "Only Snowpark and Streamlit entities are supported for migration." + ) + + SecurePath("snowflake.yml").rename("snowflake_V1.yml") + with open("snowflake.yml", "w") as file: + yaml.dump( + pd_v2.model_dump( + exclude_unset=True, exclude_none=True, mode="json", by_alias=True + ), + file, + ) + return MessageResult("Project definition migrated to version 2.") -@ws.command(requires_connection=True) +@ws.command(requires_connection=True, hidden=True) @with_project_definition() def validate( **options, @@ -40,7 +91,7 @@ def validate( return MessageResult("Project definition is valid.") -@ws.command(requires_connection=True) +@ws.command(requires_connection=True, hidden=True) @with_project_definition() def bundle( entity_id: str = typer.Option( diff --git a/src/snowflake/cli/api/commands/snow_typer.py b/src/snowflake/cli/api/commands/snow_typer.py index b3eff9e567..27c0631f0a 100644 --- a/src/snowflake/cli/api/commands/snow_typer.py +++ b/src/snowflake/cli/api/commands/snow_typer.py @@ -46,6 +46,7 @@ def __init__(self, /, **kwargs): pretty_exceptions_show_locals=False, no_args_is_help=True, add_completion=True, + rich_markup_mode="markdown", ) @staticmethod diff --git a/src/snowflake/cli/api/feature_flags.py b/src/snowflake/cli/api/feature_flags.py index 177331dbcb..2ed9728e55 100644 --- a/src/snowflake/cli/api/feature_flags.py +++ b/src/snowflake/cli/api/feature_flags.py @@ -52,5 +52,3 @@ class FeatureFlag(FeatureFlagMixin): ENABLE_STREAMLIT_VERSIONED_STAGE = BooleanFlag( "ENABLE_STREAMLIT_VERSIONED_STAGE", False ) - # TODO: remove in 3.0 - ENABLE_PROJECT_DEFINITION_V2 = BooleanFlag("ENABLE_PROJECT_DEFINITION_V2", True) diff --git a/src/snowflake/cli/api/project/definition.py b/src/snowflake/cli/api/project/definition.py index 309924371d..1f44dcabf2 100644 --- a/src/snowflake/cli/api/project/definition.py +++ b/src/snowflake/cli/api/project/definition.py @@ -30,7 +30,10 @@ to_identifier, ) from snowflake.cli.api.secure_path import SecurePath -from snowflake.cli.api.utils.definition_rendering import render_definition_template +from snowflake.cli.api.utils.definition_rendering import ( + raw_project_properties, + render_definition_template, +) from snowflake.cli.api.utils.dict_utils import deep_merge_dicts from snowflake.cli.api.utils.types import Context, Definition @@ -58,7 +61,9 @@ def _get_merged_definitions(paths: List[Path]) -> Optional[Definition]: def load_project( - paths: List[Path], context_overrides: Optional[Context] = None + paths: List[Path], + context_overrides: Optional[Context] = None, + render_templates: bool = True, ) -> ProjectProperties: """ Loads project definition, optionally overriding values. Definition values @@ -66,7 +71,10 @@ def load_project( Templating is also applied after the merging process. """ merged_definitions = _get_merged_definitions(paths) - return render_definition_template(merged_definitions, context_overrides or {}) + if render_templates: + return render_definition_template(merged_definitions, context_overrides or {}) + else: + return raw_project_properties(merged_definitions) def default_app_package(project_name: str): diff --git a/src/snowflake/cli/api/project/definition_manager.py b/src/snowflake/cli/api/project/definition_manager.py index 38d1b8bc36..5fb6e707a2 100644 --- a/src/snowflake/cli/api/project/definition_manager.py +++ b/src/snowflake/cli/api/project/definition_manager.py @@ -20,7 +20,10 @@ from typing import List, Optional from snowflake.cli.api.project.definition import ProjectProperties, load_project -from snowflake.cli.api.project.schemas.project_definition import ProjectDefinitionV1 +from snowflake.cli.api.project.schemas.project_definition import ( + ProjectDefinition, + ProjectDefinitionV1, +) from snowflake.cli.api.utils.types import Context @@ -125,10 +128,18 @@ def _user_definition_file_if_available(project_path: Path) -> Optional[Path]: def _project_properties(self) -> ProjectProperties: return load_project(self._project_config_paths, self._context_overrides) + @functools.cached_property + def _raw_project_data(self) -> ProjectProperties: + return load_project(self._project_config_paths, {}, False) + @functools.cached_property def project_definition(self) -> ProjectDefinitionV1: return self._project_properties.project_definition + @functools.cached_property + def unrendered_project_definition(self) -> ProjectDefinition: + return self._raw_project_data.project_definition + @functools.cached_property def template_context(self) -> Context: return self._project_properties.project_context diff --git a/src/snowflake/cli/api/project/schemas/entities/common.py b/src/snowflake/cli/api/project/schemas/entities/common.py index e9307a462f..fc299971d4 100644 --- a/src/snowflake/cli/api/project/schemas/entities/common.py +++ b/src/snowflake/cli/api/project/schemas/entities/common.py @@ -72,11 +72,6 @@ class DefaultsField(UpdatableModel): default=None, ) - project_name: Optional[str] = Field( - title="Name of the project.", - default="my_project", - ) - class EntityModelBase(ABC, UpdatableModel): @classmethod diff --git a/src/snowflake/cli/api/project/schemas/entities/snowpark_entity.py b/src/snowflake/cli/api/project/schemas/entities/snowpark_entity.py index 2b9c92118d..2ac37e799f 100644 --- a/src/snowflake/cli/api/project/schemas/entities/snowpark_entity.py +++ b/src/snowflake/cli/api/project/schemas/entities/snowpark_entity.py @@ -24,7 +24,23 @@ ExternalAccessBaseModel, ) from snowflake.cli.api.project.schemas.snowpark.argument import Argument -from snowflake.cli.api.project.schemas.updatable_model import DiscriminatorField +from snowflake.cli.api.project.schemas.updatable_model import ( + DiscriminatorField, + UpdatableModel, +) + + +class PathMapping(UpdatableModel): + class Config: + frozen = True + + src: Path = Field(title="Source path (relative to project root)", default=None) + + dest: Optional[str] = Field( + title="Destination path on stage", + description="Paths are relative to stage root; paths ending with a slash indicate that the destination is a directory which source files should be copied into.", + default=None, + ) class SnowparkEntityModel(EntityModelBase, ExternalAccessBaseModel): @@ -46,7 +62,18 @@ class SnowparkEntityModel(EntityModelBase, ExternalAccessBaseModel): default=[], ) stage: str = Field(title="Stage in which artifacts will be stored") - artifacts: List[Path] = Field(title="List of required sources") + artifacts: List[Union[PathMapping, str]] = Field(title="List of required sources") + + @field_validator("artifacts") + @classmethod + def _convert_artifacts(cls, artifacts: Union[dict, str]): + _artifacts = [] + for artefact in artifacts: + if isinstance(artefact, PathMapping): + _artifacts.append(artefact) + else: + _artifacts.append(PathMapping(src=artefact)) + return _artifacts @field_validator("runtime") @classmethod diff --git a/src/snowflake/cli/api/project/schemas/project_definition.py b/src/snowflake/cli/api/project/schemas/project_definition.py index 6545dc5aa2..271fe3ce82 100644 --- a/src/snowflake/cli/api/project/schemas/project_definition.py +++ b/src/snowflake/cli/api/project/schemas/project_definition.py @@ -19,7 +19,6 @@ from packaging.version import Version from pydantic import Field, ValidationError, field_validator, model_validator -from snowflake.cli.api.feature_flags import FeatureFlag from snowflake.cli.api.project.errors import SchemaValidationError from snowflake.cli.api.project.schemas.entities.application_entity_model import ( ApplicationEntityModel, @@ -244,9 +243,7 @@ def build_project_definition(**data) -> ProjectDefinition: def get_version_map(): - version_map = {"1": DefinitionV10, "1.1": DefinitionV11} - if FeatureFlag.ENABLE_PROJECT_DEFINITION_V2.is_enabled(): - version_map["2"] = DefinitionV20 + version_map = {"1": DefinitionV10, "1.1": DefinitionV11, "2": DefinitionV20} return version_map diff --git a/src/snowflake/cli/api/secure_path.py b/src/snowflake/cli/api/secure_path.py index 1edceebde3..068bfe263e 100644 --- a/src/snowflake/cli/api/secure_path.py +++ b/src/snowflake/cli/api/secure_path.py @@ -349,6 +349,9 @@ def _assert_file_size_limit(self, size_limit_in_mb): ): raise FileTooLargeError(self._path.resolve(), size_limit_in_mb) + def rename(self, new_name: Union[str | Path]): + self._path.rename(new_name) + def _raise_file_exists_error(path: Path): raise FileExistsError(errno.EEXIST, os.strerror(errno.EEXIST), path) diff --git a/src/snowflake/cli/api/utils/definition_rendering.py b/src/snowflake/cli/api/utils/definition_rendering.py index 18ea5c451d..c5023e3029 100644 --- a/src/snowflake/cli/api/utils/definition_rendering.py +++ b/src/snowflake/cli/api/utils/definition_rendering.py @@ -386,3 +386,10 @@ def on_cycle_action(node: Node[TemplateVar]): default_env=project_context[CONTEXT_KEY].get("env"), override_env=override_env ) return ProjectProperties(project_definition, project_context) + + +def raw_project_properties(definition: Definition) -> ProjectProperties: + """ + Returns the raw project definition data without any templating. + """ + return ProjectProperties(build_project_definition(**definition), {}) diff --git a/tests/__snapshots__/test_docs_generation_output.ambr b/tests/__snapshots__/test_docs_generation_output.ambr index b275188513..8f745c62cc 100644 --- a/tests/__snapshots__/test_docs_generation_output.ambr +++ b/tests/__snapshots__/test_docs_generation_output.ambr @@ -1,9 +1,7 @@ # serializer version: 1 # name: test_flags_have_default_values ''' - Given a prompt, the command generates a response using your choice of language model. - In the simplest use case, the prompt is a single string. - You may also provide a JSON file with conversation history including multiple prompts and responses for interactive chat-style usage. + Given a prompt, the command generates a response using your choice of language model. In the simplest use case, the prompt is a single string. You may also provide a JSON file with conversation history including multiple prompts and responses for interactive chat-style usage. Syntax =============================================================================== @@ -110,6 +108,5 @@ :samp:`--silent` Turns off intermediate output to console. Default: False. - ''' # --- diff --git a/tests/__snapshots__/test_help_messages.ambr b/tests/__snapshots__/test_help_messages.ambr index e71bd295bc..2d15cb2525 100644 --- a/tests/__snapshots__/test_help_messages.ambr +++ b/tests/__snapshots__/test_help_messages.ambr @@ -34,6 +34,7 @@ | sql Executes Snowflake query. | | stage Manages stages. | | streamlit Manages a Streamlit app in Snowflake. | + | ws Deploy and interact with snowflake.yml-based entities. | +------------------------------------------------------------------------------+ @@ -56,9 +57,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -74,8 +75,8 @@ Creates an application package in your Snowflake account and syncs the local changes to the stage without creating or updating the application. Running - this command with no arguments at all, as in `snow app deploy`, is a shorthand - for `snow app deploy --prune --recursive`. + this command with no arguments at all, as in snow app deploy, is a shorthand + for snow app deploy --prune --recursive. +- Arguments ------------------------------------------------------------------+ | paths [PATHS]... Paths, relative to the the project root, of files | @@ -117,8 +118,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -162,9 +163,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -189,8 +190,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -234,9 +235,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -313,8 +314,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -358,9 +359,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -408,7 +409,7 @@ | --template TEXT A specific template name within the template | | repo to use as template for the Snowflake | | Native App project. Example: Default is basic | - | if `--template-repo` is | + | if --template-repo is | | https://github.com/snowflakedb/native-apps-t… | | and None if any other --template-repo is | | specified. | @@ -418,9 +419,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -443,9 +444,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -471,8 +472,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -516,9 +517,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -552,8 +553,8 @@ | [default: None] | | --patch INTEGER The patch number | | under the given | - | `--version` defined | - | in an existing | + | --version defined in | + | an existing | | application package | | that should be used | | to create an | @@ -624,8 +625,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -669,9 +670,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -719,8 +720,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -764,9 +765,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -791,8 +792,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -836,9 +837,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -859,7 +860,7 @@ | version [VERSION] Version to define in your application package. If | | the version already exists, an auto-incremented | | patch is added to the version instead. Defaults to | - | the version specified in the `manifest.yml` file. | + | the version specified in the manifest.yml file. | | [default: None] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ @@ -870,10 +871,9 @@ | set, which means the | | Snowflake CLI either uses | | the patch specified in | - | the `manifest.yml` file | - | or automatically | - | generates a new patch | - | number. | + | the manifest.yml file or | + | automatically generates a | + | new patch number. | | [default: None] | | --skip-git-check When enabled, the | | Snowflake CLI skips | @@ -913,8 +913,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -958,9 +958,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -975,13 +975,13 @@ Usage: default app version drop [OPTIONS] [VERSION] Drops a version defined in your application package. Versions can either be - passed in as an argument to the command or read from the `manifest.yml` file. + passed in as an argument to the command or read from the manifest.yml file. Dropping patches is not allowed. +- Arguments ------------------------------------------------------------------+ | version [VERSION] Version defined in an application package that you | | want to drop. Defaults to the version specified in | - | the `manifest.yml` file. | + | the manifest.yml file. | | [default: None] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ @@ -1011,8 +1011,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1056,9 +1056,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1083,8 +1083,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1128,9 +1128,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1155,7 +1155,7 @@ | version with patch 0. | | drop Drops a version defined in your application package. Versions can | | either be passed in as an argument to the command or read from the | - | `manifest.yml` file. Dropping patches is not allowed. | + | manifest.yml file. Dropping patches is not allowed. | | list Lists all versions defined in an application package. | +------------------------------------------------------------------------------+ @@ -1177,8 +1177,8 @@ | deploy Creates an application package in your Snowflake account and | | syncs the local changes to the stage without creating or updating | | the application. Running this command with no arguments at all, | - | as in `snow app deploy`, is a shorthand for `snow app deploy | - | --prune --recursive`. | + | as in snow app deploy, is a shorthand for snow app deploy --prune | + | --recursive. | | events Fetches events for this app from the event table configured in | | Snowflake. | | init Initializes a Snowflake Native App project. | @@ -1242,9 +1242,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1266,9 +1266,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1285,8 +1285,7 @@ Changes default connection to provided value. +- Arguments ------------------------------------------------------------------+ - | * name TEXT Name of the connection, as defined in your | - | `config.toml` | + | * name TEXT Name of the connection, as defined in your config.toml | | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ @@ -1295,9 +1294,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1318,8 +1317,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1363,9 +1362,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1423,8 +1422,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1468,9 +1467,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1495,8 +1494,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1540,9 +1539,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1567,8 +1566,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1612,9 +1611,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1629,9 +1628,8 @@ Usage: default git execute [OPTIONS] REPOSITORY_PATH Execute immediate all files from the repository path. Files can be filtered - with glob like pattern, e.g. `@my_repo/branches/main/*.sql`, - `@my_repo/branches/main/dev/*`. Only files with `.sql` extension will be - executed. + with glob like pattern, e.g. @my_repo/branches/main/*.sql, + @my_repo/branches/main/dev/*. Only files with .sql extension will be executed. +- Arguments ------------------------------------------------------------------+ | * repository_path TEXT Path to git repository stage with scope | @@ -1645,7 +1643,7 @@ | Defaults to break. | | [default: break] | | --variable -D TEXT Variables for the execution context. | - | For example: `-D "="`. For | + | For example: -D "=". For | | SQL files variables are use to expand | | the template and any unknown variable | | will cause an error. For Python files | @@ -1653,15 +1651,14 @@ | os.environ dictionary. Provided keys | | are capitalized to adhere to best | | practices.In case of SQL files string | - | values must be quoted in `''` | - | (consider embedding quoting in the | - | file). | + | values must be quoted in '' (consider | + | embedding quoting in the file). | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1705,9 +1702,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1733,8 +1730,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1778,9 +1775,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1803,15 +1800,15 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by name. For | - | example, `list-branches --like "%_test"` lists all | + | example, list-branches --like "%_test" lists all | | branches that end with "_test". | | [default: %%] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1855,9 +1852,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1882,14 +1879,14 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --pattern TEXT Regex pattern for filtering files by name. For | - | example --pattern ".*\.txt" will filter only files | + | example --pattern ".*.txt" will filter only files | | with .txt extension. | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -1933,9 +1930,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -1958,15 +1955,15 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by name. For | - | example, `list-tags --like "v2.0%"` lists all tags | - | that start with "v2.0". | + | example, list-tags --like "v2.0%" lists all tags that | + | start with "v2.0". | | [default: %%] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2010,9 +2007,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2030,20 +2027,22 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list --like "my%"` lists | + | name. For example, list --like "my%" lists | | all git repositories with name that begin | | with “my”. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | --in database my_db`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list --in database | + | my_db. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2087,9 +2086,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2104,12 +2103,17 @@ Usage: default git setup [OPTIONS] REPOSITORY_NAME Sets up a git repository object. + + Usage notes + You will be prompted for: - * url - address of repository to be used for git clone operation - * secret - Snowflake secret containing authentication credentials. Not needed - if origin repository does not require authentication for RO operations (clone, - fetch) - * API integration - object allowing Snowflake to interact with git repository. + + • url - address of repository to be used for git clone operation + • secret - Snowflake secret containing authentication credentials. Not needed + if origin repository does not require authentication for RO operations + (clone, fetch) + • API integration - object allowing Snowflake to interact with git + repository. +- Arguments ------------------------------------------------------------------+ | * repository_name TEXT Identifier of the git repository. For | @@ -2121,8 +2125,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2166,9 +2170,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2194,9 +2198,8 @@ | drop Drops git repository with given name. | | execute Execute immediate all files from the repository path. Files | | can be filtered with glob like pattern, e.g. | - | `@my_repo/branches/main/*.sql`, | - | `@my_repo/branches/main/dev/*`. Only files with `.sql` | - | extension will be executed. | + | @my_repo/branches/main/*.sql, @my_repo/branches/main/dev/*. | + | Only files with .sql extension will be executed. | | fetch Fetch changes from origin to Snowflake repository. | | list Lists all available git repositories. | | list-branches List all branches in the repository. | @@ -2229,7 +2232,7 @@ | git repository with templates. | | [default: | | https://github.com/snowflakedb/snowflake-c… | - | --variable -D TEXT String in `key=value` format. Provided | + | --variable -D TEXT String in key=value format. Provided | | variables will not be prompted for. | | --no-interactive Disable prompting. | | --help -h Show this message and exit. | @@ -2237,9 +2240,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2262,14 +2265,14 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | * --notebook-file -f TEXT Stage path with notebook file. For example | - | `@stage/path/to/notebook.ipynb` | + | @stage/path/to/notebook.ipynb | | [required] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2313,9 +2316,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2341,8 +2344,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2386,9 +2389,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2414,8 +2417,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2459,9 +2462,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2487,8 +2490,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2532,9 +2535,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2581,24 +2584,23 @@ | key=value pairs, for | | example name=my_db | | comment='created with | - | Snowflake CLI'. | - | Check documentation for | - | the full list of | - | available parameters for | - | every object. | + | Snowflake CLI'. Check | + | documentation for the | + | full list of available | + | parameters for every | + | object. | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --json TEXT Object definition in JSON format, for example | | '{"name": "my_db", "comment": "created with Snowflake | - | CLI"}'. | - | Check documentation for the full list of available | - | parameters for every object. | + | CLI"}'. Check documentation for the full list of | + | available parameters for every object. | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2642,9 +2644,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2667,15 +2669,16 @@ | * object_type TEXT Type of object. For example table, database, | | compute-pool. | | [required] | - | * object_name TEXT Name of the object. [required] | + | * object_name TEXT Name of the object. | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2719,9 +2722,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2745,15 +2748,16 @@ | * object_type TEXT Type of object. For example table, database, | | compute-pool. | | [required] | - | * object_name TEXT Name of the object. [required] | + | * object_name TEXT Name of the object. | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2797,9 +2801,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2826,22 +2830,24 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list function --like | - | "my%"` lists all functions that begin with | + | name. For example, list function --like | + | "my%" lists all functions that begin with | | “my”. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | table --in database my_db`. Some object | - | types have specialized scopes (e.g. list | - | service --in compute-pool my_pool). | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list table --in | + | database my_db. Some object types have | + | specialized scopes (e.g. list service --in | + | compute-pool my_pool). | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2885,9 +2891,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -2923,8 +2929,8 @@ Usage: default snowpark build [OPTIONS] Builds artifacts required for the Snowpark project. The artifacts can be used - by `deploy` command. For each directory in artifacts a .zip file is created. - All non-anaconda dependencies are packaged in dependencies.zip file. + by deploy command. For each directory in artifacts a .zip file is created. All + non-anaconda dependencies are packaged in dependencies.zip file. +- Options --------------------------------------------------------------------+ | --ignore-anaconda Does not lookup packages on | @@ -2951,8 +2957,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -2996,9 +3002,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3014,7 +3020,7 @@ Deploys procedures and functions defined in project. Deploying the project alters all objects defined in it. By default, if any of the objects exist - already the commands will fail unless `--replace` flag is provided. Required + already the commands will fail unless --replace flag is provided. Required artifacts are deployed before creating functions or procedures. Dependencies are deployed once to every stage specified in definitions. @@ -3029,8 +3035,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3074,9 +3080,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3107,8 +3113,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3152,9 +3158,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3185,8 +3191,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3230,9 +3236,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3265,8 +3271,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3310,9 +3316,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3334,20 +3340,22 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list function --like | - | "my%"` lists all functions that begin with | + | name. For example, list function --like | + | "my%" lists all functions that begin with | | “my”. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | function --in database my_db`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list function --in | + | database my_db. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3391,9 +3399,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3411,7 +3419,8 @@ imported for a Snowpark Python app. +- Arguments ------------------------------------------------------------------+ - | * name TEXT Name of the package to create. [required] | + | * name TEXT Name of the package to create. | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --ignore-anaconda Does not lookup packages on | @@ -3432,8 +3441,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3477,9 +3486,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3496,15 +3505,16 @@ Checks if a package is available on the Snowflake Anaconda channel. +- Arguments ------------------------------------------------------------------+ - | * package_name TEXT Name of the package. [required] | + | * package_name TEXT Name of the package. | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3548,9 +3558,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3568,7 +3578,8 @@ in the imports of a procedure or function. +- Options --------------------------------------------------------------------+ - | * --file -f PATH Path to the file to upload. [required] | + | * --file -f PATH Path to the file to upload. | + | [required] | | * --stage -s TEXT Name of the stage in which to upload the file, | | not including the @ symbol. | | [required] | @@ -3577,8 +3588,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3622,9 +3633,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3666,13 +3677,13 @@ +------------------------------------------------------------------------------+ +- Commands -------------------------------------------------------------------+ | build Builds artifacts required for the Snowpark project. The artifacts | - | can be used by `deploy` command. For each directory in artifacts | - | a .zip file is created. All non-anaconda dependencies are | - | packaged in dependencies.zip file. | + | can be used by deploy command. For each directory in artifacts a | + | .zip file is created. All non-anaconda dependencies are packaged | + | in dependencies.zip file. | | deploy Deploys procedures and functions defined in project. Deploying | | the project alters all objects defined in it. By default, if any | | of the objects exist already the commands will fail unless | - | `--replace` flag is provided. Required artifacts are deployed | + | --replace flag is provided. Required artifacts are deployed | | before creating functions or procedures. Dependencies are | | deployed once to every stage specified in definitions. | | describe Provides description of a procedure or function. | @@ -3754,8 +3765,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3799,9 +3810,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3827,8 +3838,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3872,9 +3883,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3900,8 +3911,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -3945,9 +3956,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -3965,15 +3976,15 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by name. For | - | example, `list --like "my%"` lists all compute pools | + | example, list --like "my%" lists all compute pools | | that begin with “my”.. | | [default: %%] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4017,9 +4028,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4045,8 +4056,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4090,9 +4101,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4143,8 +4154,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4188,9 +4199,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4217,8 +4228,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4262,9 +4273,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4290,8 +4301,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4335,9 +4346,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4364,8 +4375,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4409,9 +4420,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4446,8 +4457,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4491,9 +4502,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4546,8 +4557,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4591,9 +4602,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4616,8 +4627,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4661,17 +4672,17 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | +------------------------------------------------------------------------------+ Usage Example: snow spcs image-registry token --format JSON | docker login - $(snow spcs image-registry url) -u 0sessiontoken --password-stdin - See the following for how to use this command to authenticate with SSO: + $(snow spcs image-registry url) -u 0sessiontoken --password-stdin See the + following for how to use this command to authenticate with SSO: https://community.snowflake.com/s/article/Authenticating-with-Snowpark-Contain er-Services-Image-Repository-via-SSO-and-Token-with-Snow-CLI @@ -4693,8 +4704,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4738,9 +4749,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4790,8 +4801,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4835,9 +4846,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4863,8 +4874,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4908,9 +4919,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -4936,8 +4947,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -4981,9 +4992,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5013,8 +5024,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5058,9 +5069,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5078,20 +5089,22 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list --like "my%"` lists | + | name. For example, list --like "my%" lists | | all image repositories that begin with | | “my”.. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | --in database my_db`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list --in database | + | my_db. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5135,9 +5148,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5163,8 +5176,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5208,9 +5221,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5239,241 +5252,6 @@ +------------------------------------------------------------------------------+ - ''' -# --- -# name: test_help_messages[spcs.job.create] - ''' - - Usage: default spcs job create [OPTIONS] - - Creates a job to run in a compute pool. - - +- Options --------------------------------------------------------------------+ - | * --compute-pool TEXT Name of the pool in which to run the job. | - | [required] | - | * --spec-path FILE Path to the `spec.yaml` file containing the | - | job details. | - | [required] | - | --help -h Show this message and exit. | - +------------------------------------------------------------------------------+ - +- Connection configuration ---------------------------------------------------+ - | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | - | --account,--accountname TEXT Name assigned to your Snowflake | - | account. Overrides the value | - | specified for the connection. | - | --user,--username TEXT Username to connect to Snowflake. | - | Overrides the value specified for | - | the connection. | - | --password TEXT Snowflake password. Overrides the | - | value specified for the | - | connection. | - | --authenticator TEXT Snowflake authenticator. Overrides | - | the value specified for the | - | connection. | - | --private-key-path TEXT Snowflake private key path. | - | Overrides the value specified for | - | the connection. | - | --token-file-path TEXT Path to file with an OAuth token | - | that should be used when | - | connecting to Snowflake | - | --database,--dbname TEXT Database to use. Overrides the | - | value specified for the | - | connection. | - | --schema,--schemaname TEXT Database schema to use. Overrides | - | the value specified for the | - | connection. | - | --role,--rolename TEXT Role to use. Overrides the value | - | specified for the connection. | - | --warehouse TEXT Warehouse to use. Overrides the | - | value specified for the | - | connection. | - | --temporary-connection -x Uses connection defined with | - | command line parameters, instead | - | of one defined in config | - | --mfa-passcode TEXT Token to use for multi-factor | - | authentication (MFA) | - | --enable-diag Run python connector diagnostic | - | test | - | --diag-log-path TEXT Diagnostic report path | - | --diag-allowlist-path TEXT Diagnostic report path to optional | - | allowlist | - +------------------------------------------------------------------------------+ - +- Global configuration -------------------------------------------------------+ - | --format [TABLE|JSON] Specifies the output format. | - | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | - | and higher. | - | --debug Displays log entries for log levels `debug` | - | and higher; debug logs contains additional | - | information. | - | --silent Turns off intermediate output to console. | - +------------------------------------------------------------------------------+ - - - ''' -# --- -# name: test_help_messages[spcs.job.logs] - ''' - - Usage: default spcs job logs [OPTIONS] IDENTIFIER - - Retrieves local logs from a job container. - - +- Arguments ------------------------------------------------------------------+ - | * identifier TEXT Job id [required] | - +------------------------------------------------------------------------------+ - +- Options --------------------------------------------------------------------+ - | * --container-name TEXT Name of the container. [required] | - | --help -h Show this message and exit. | - +------------------------------------------------------------------------------+ - +- Connection configuration ---------------------------------------------------+ - | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | - | --account,--accountname TEXT Name assigned to your Snowflake | - | account. Overrides the value | - | specified for the connection. | - | --user,--username TEXT Username to connect to Snowflake. | - | Overrides the value specified for | - | the connection. | - | --password TEXT Snowflake password. Overrides the | - | value specified for the | - | connection. | - | --authenticator TEXT Snowflake authenticator. Overrides | - | the value specified for the | - | connection. | - | --private-key-path TEXT Snowflake private key path. | - | Overrides the value specified for | - | the connection. | - | --token-file-path TEXT Path to file with an OAuth token | - | that should be used when | - | connecting to Snowflake | - | --database,--dbname TEXT Database to use. Overrides the | - | value specified for the | - | connection. | - | --schema,--schemaname TEXT Database schema to use. Overrides | - | the value specified for the | - | connection. | - | --role,--rolename TEXT Role to use. Overrides the value | - | specified for the connection. | - | --warehouse TEXT Warehouse to use. Overrides the | - | value specified for the | - | connection. | - | --temporary-connection -x Uses connection defined with | - | command line parameters, instead | - | of one defined in config | - | --mfa-passcode TEXT Token to use for multi-factor | - | authentication (MFA) | - | --enable-diag Run python connector diagnostic | - | test | - | --diag-log-path TEXT Diagnostic report path | - | --diag-allowlist-path TEXT Diagnostic report path to optional | - | allowlist | - +------------------------------------------------------------------------------+ - +- Global configuration -------------------------------------------------------+ - | --format [TABLE|JSON] Specifies the output format. | - | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | - | and higher. | - | --debug Displays log entries for log levels `debug` | - | and higher; debug logs contains additional | - | information. | - | --silent Turns off intermediate output to console. | - +------------------------------------------------------------------------------+ - - - ''' -# --- -# name: test_help_messages[spcs.job.status] - ''' - - Usage: default spcs job status [OPTIONS] IDENTIFIER - - Returns the status of a named Snowpark Container Services job. - - +- Arguments ------------------------------------------------------------------+ - | * identifier TEXT ID of the job. [required] | - +------------------------------------------------------------------------------+ - +- Options --------------------------------------------------------------------+ - | --help -h Show this message and exit. | - +------------------------------------------------------------------------------+ - +- Connection configuration ---------------------------------------------------+ - | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | - | --account,--accountname TEXT Name assigned to your Snowflake | - | account. Overrides the value | - | specified for the connection. | - | --user,--username TEXT Username to connect to Snowflake. | - | Overrides the value specified for | - | the connection. | - | --password TEXT Snowflake password. Overrides the | - | value specified for the | - | connection. | - | --authenticator TEXT Snowflake authenticator. Overrides | - | the value specified for the | - | connection. | - | --private-key-path TEXT Snowflake private key path. | - | Overrides the value specified for | - | the connection. | - | --token-file-path TEXT Path to file with an OAuth token | - | that should be used when | - | connecting to Snowflake | - | --database,--dbname TEXT Database to use. Overrides the | - | value specified for the | - | connection. | - | --schema,--schemaname TEXT Database schema to use. Overrides | - | the value specified for the | - | connection. | - | --role,--rolename TEXT Role to use. Overrides the value | - | specified for the connection. | - | --warehouse TEXT Warehouse to use. Overrides the | - | value specified for the | - | connection. | - | --temporary-connection -x Uses connection defined with | - | command line parameters, instead | - | of one defined in config | - | --mfa-passcode TEXT Token to use for multi-factor | - | authentication (MFA) | - | --enable-diag Run python connector diagnostic | - | test | - | --diag-log-path TEXT Diagnostic report path | - | --diag-allowlist-path TEXT Diagnostic report path to optional | - | allowlist | - +------------------------------------------------------------------------------+ - +- Global configuration -------------------------------------------------------+ - | --format [TABLE|JSON] Specifies the output format. | - | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | - | and higher. | - | --debug Displays log entries for log levels `debug` | - | and higher; debug logs contains additional | - | information. | - | --silent Turns off intermediate output to console. | - +------------------------------------------------------------------------------+ - - - ''' -# --- -# name: test_help_messages[spcs.job] - ''' - - Usage: default spcs job [OPTIONS] COMMAND [ARGS]... - - Manages Snowpark jobs. - - +- Options --------------------------------------------------------------------+ - | --help -h Show this message and exit. | - +------------------------------------------------------------------------------+ - +- Commands -------------------------------------------------------------------+ - | create Creates a job to run in a compute pool. | - | logs Retrieves local logs from a job container. | - | status Returns the status of a named Snowpark Container Services job. | - +------------------------------------------------------------------------------+ - - ''' # --- # name: test_help_messages[spcs.service.create] @@ -5554,8 +5332,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5599,9 +5377,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5626,8 +5404,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5671,9 +5449,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5698,8 +5476,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5743,9 +5521,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5780,13 +5558,14 @@ | without explicitly specifying a | | warehouse to use. | | [default: None] | - | --comment TEXT Comment for the service. [default: None] | + | --comment TEXT Comment for the service. | + | [default: None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5830,9 +5609,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5857,8 +5636,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5902,9 +5681,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -5922,19 +5701,21 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list --like "my%"` lists | + | name. For example, list --like "my%" lists | | all services that begin with “my”.. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | --in compute-pool my_pool`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list --in compute-pool | + | my_pool. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -5978,9 +5759,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6001,7 +5782,8 @@ | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ - | * --container-name TEXT Name of the container. [required] | + | * --container-name TEXT Name of the container. | + | [required] | | * --instance-id TEXT ID of the service instance, starting | | with 0. | | [required] | @@ -6011,8 +5793,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6056,9 +5838,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6083,8 +5865,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6128,9 +5910,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6184,8 +5966,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6229,9 +6011,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6256,8 +6038,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6301,9 +6083,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6328,8 +6110,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6373,9 +6155,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6413,8 +6195,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6458,9 +6240,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6481,13 +6263,14 @@ | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ - | * --spec-path FILE Path to service specification file. [required] | + | * --spec-path FILE Path to service specification file. | + | [required] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6531,9 +6314,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6600,12 +6383,11 @@ Usage: default sql [OPTIONS] Executes Snowflake query. - Use either query, filename or input option. - Query to execute can be specified using query option, filename option (all - queries from file will be executed) or via stdin by piping output from other - command. For example `cat my.sql | snow sql -i`. - The command supports variable substitution that happens on client-side. Both - &VARIABLE or &{ VARIABLE } syntax are supported. + Use either query, filename or input option. Query to execute can be specified + using query option, filename option (all queries from file will be executed) + or via stdin by piping output from other command. For example cat my.sql | + snow sql -i. The command supports variable substitution that happens on + client-side. Both &VARIABLE or &{ VARIABLE } syntax are supported. +- Options --------------------------------------------------------------------+ | --query -q TEXT Query to execute. | @@ -6623,8 +6405,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6668,9 +6450,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6723,8 +6505,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6768,9 +6550,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6795,8 +6577,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6840,9 +6622,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6867,8 +6649,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6912,9 +6694,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -6931,16 +6713,18 @@ Diffs a stage with a local folder. +- Arguments ------------------------------------------------------------------+ - | * stage_name TEXT Fully qualified name of a stage [required] | - | * folder_name TEXT Path to local folder [required] | + | * stage_name TEXT Fully qualified name of a stage | + | [required] | + | * folder_name TEXT Path to local folder | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -6984,9 +6768,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7011,8 +6795,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7056,9 +6840,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7073,12 +6857,12 @@ Usage: default stage execute [OPTIONS] STAGE_PATH Execute immediate all files from the stage path. Files can be filtered with - glob like pattern, e.g. `@stage/*.sql`, `@stage/dev/*`. Only files with `.sql` + glob like pattern, e.g. @stage/*.sql, @stage/dev/*. Only files with .sql extension will be executed. +- Arguments ------------------------------------------------------------------+ | * stage_path TEXT Stage path with files to be execute. For example | - | `@stage/dev/*`. | + | @stage/dev/*. | | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ @@ -7086,7 +6870,7 @@ | Defaults to break. | | [default: break] | | --variable -D TEXT Variables for the execution context. | - | For example: `-D "="`. For | + | For example: -D "=". For | | SQL files variables are use to expand | | the template and any unknown variable | | will cause an error. For Python files | @@ -7094,15 +6878,14 @@ | os.environ dictionary. Provided keys | | are capitalized to adhere to best | | practices.In case of SQL files string | - | values must be quoted in `''` | - | (consider embedding quoting in the | - | file). | + | values must be quoted in '' (consider | + | embedding quoting in the file). | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7146,9 +6929,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7170,14 +6953,14 @@ +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --pattern TEXT Regex pattern for filtering files by name. For | - | example --pattern ".*\.txt" will filter only files | + | example --pattern ".*.txt" will filter only files | | with .txt extension. | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7221,9 +7004,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7241,19 +7024,21 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list --like "my%"` lists | + | name. For example, list --like "my%" lists | | all stages that begin with “my”. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | --in database my_db`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list --in database | + | my_db. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7297,9 +7082,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7318,15 +7103,16 @@ +- Arguments ------------------------------------------------------------------+ | * stage_name TEXT Identifier of the stage. For example: @my_stage | | [required] | - | * file_name TEXT Name of the file to remove. [required] | + | * file_name TEXT Name of the file to remove. | + | [required] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7370,9 +7156,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7399,9 +7185,8 @@ | describe Provides description of stage. | | drop Drops stage with given name. | | execute Execute immediate all files from the stage path. Files can be | - | filtered with glob like pattern, e.g. `@stage/*.sql`, | - | `@stage/dev/*`. Only files with `.sql` extension will be | - | executed. | + | filtered with glob like pattern, e.g. @stage/*.sql, | + | @stage/dev/*. Only files with .sql extension will be executed. | | list Lists all available stages. | | list-files Lists the stage contents. | | remove Removes a file from a stage. | @@ -7417,13 +7202,14 @@ Deploys a Streamlit app defined in the project definition file (snowflake.yml). By default, the command uploads environment.yml and any other - pages or folders, if present. If you don’t specify a stage name, the - `streamlit` stage is used. If the specified stage does not exist, the command - creates it. If multiple Streamlits are defined in snowflake.yml and no - entity_id is provided then command will raise an error. + pages or folders, if present. If you don’t specify a stage name, the streamlit + stage is used. If the specified stage does not exist, the command creates it. + If multiple Streamlits are defined in snowflake.yml and no entity_id is + provided then command will raise an error. +- Arguments ------------------------------------------------------------------+ - | entity_id [ENTITY_ID] ID of streamlit entity. [default: None] | + | entity_id [ENTITY_ID] ID of streamlit entity. | + | [default: None] | +------------------------------------------------------------------------------+ +- Options --------------------------------------------------------------------+ | --replace Replace the Streamlit app if it already exists. | @@ -7436,8 +7222,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7481,9 +7267,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7509,8 +7295,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7554,9 +7340,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7582,8 +7368,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7627,9 +7413,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7656,8 +7442,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7701,9 +7487,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7721,19 +7507,21 @@ +- Options --------------------------------------------------------------------+ | --like -l TEXT SQL LIKE pattern for filtering objects by | - | name. For example, `list --like "my%"` lists | + | name. For example, list --like "my%" lists | | all streamlit apps that begin with “my”. | | [default: %%] | - | --in ... Specifies the scope of this command using | - | '--in ', for example `list | - | --in database my_db`. | + | --in ... | + | | + | Specifies the scope of this command using | + | '--in ', for example list --in database | + | my_db. | | [default: None, None] | | --help -h Show this message and exit. | +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7777,9 +7565,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7807,8 +7595,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -7852,9 +7640,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -7877,10 +7665,10 @@ | deploy Deploys a Streamlit app defined in the project definition file | | (snowflake.yml). By default, the command uploads environment.yml | | and any other pages or folders, if present. If you don’t specify | - | a stage name, the `streamlit` stage is used. If the specified | - | stage does not exist, the command creates it. If multiple | - | Streamlits are defined in snowflake.yml and no entity_id is | - | provided then command will raise an error. | + | a stage name, the streamlit stage is used. If the specified stage | + | does not exist, the command creates it. If multiple Streamlits | + | are defined in snowflake.yml and no entity_id is provided then | + | command will raise an error. | | describe Provides description of streamlit. | | drop Drops streamlit with given name. | | get-url Returns a URL to the specified Streamlit app | @@ -7926,6 +7714,7 @@ | sql Executes Snowflake query. | | stage Manages stages. | | streamlit Manages a Streamlit app in Snowflake. | + | ws Deploy and interact with snowflake.yml-based entities. | +------------------------------------------------------------------------------+ @@ -7947,7 +7736,7 @@ | version with patch 0. | | drop Drops a version defined in your application package. Versions can | | either be passed in as an argument to the command or read from the | - | `manifest.yml` file. Dropping patches is not allowed. | + | manifest.yml file. Dropping patches is not allowed. | | list Lists all versions defined in an application package. | +------------------------------------------------------------------------------+ @@ -7969,8 +7758,8 @@ | deploy Creates an application package in your Snowflake account and | | syncs the local changes to the stage without creating or updating | | the application. Running this command with no arguments at all, | - | as in `snow app deploy`, is a shorthand for `snow app deploy | - | --prune --recursive`. | + | as in snow app deploy, is a shorthand for snow app deploy --prune | + | --recursive. | | events Fetches events for this app from the event table configured in | | Snowflake. | | init Initializes a Snowflake Native App project. | @@ -8025,9 +7814,8 @@ | drop Drops git repository with given name. | | execute Execute immediate all files from the repository path. Files | | can be filtered with glob like pattern, e.g. | - | `@my_repo/branches/main/*.sql`, | - | `@my_repo/branches/main/dev/*`. Only files with `.sql` | - | extension will be executed. | + | @my_repo/branches/main/*.sql, @my_repo/branches/main/dev/*. | + | Only files with .sql extension will be executed. | | fetch Fetch changes from origin to Snowflake repository. | | list Lists all available git repositories. | | list-branches List all branches in the repository. | @@ -8113,13 +7901,13 @@ +------------------------------------------------------------------------------+ +- Commands -------------------------------------------------------------------+ | build Builds artifacts required for the Snowpark project. The artifacts | - | can be used by `deploy` command. For each directory in artifacts | - | a .zip file is created. All non-anaconda dependencies are | - | packaged in dependencies.zip file. | + | can be used by deploy command. For each directory in artifacts a | + | .zip file is created. All non-anaconda dependencies are packaged | + | in dependencies.zip file. | | deploy Deploys procedures and functions defined in project. Deploying | | the project alters all objects defined in it. By default, if any | | of the objects exist already the commands will fail unless | - | `--replace` flag is provided. Required artifacts are deployed | + | --replace flag is provided. Required artifacts are deployed | | before creating functions or procedures. Dependencies are | | deployed once to every stage specified in definitions. | | describe Provides description of a procedure or function. | @@ -8202,25 +7990,6 @@ +------------------------------------------------------------------------------+ - ''' -# --- -# name: test_help_messages_no_help_flag[spcs.job] - ''' - - Usage: default spcs job [OPTIONS] COMMAND [ARGS]... - - Manages Snowpark jobs. - - +- Options --------------------------------------------------------------------+ - | --help -h Show this message and exit. | - +------------------------------------------------------------------------------+ - +- Commands -------------------------------------------------------------------+ - | create Creates a job to run in a compute pool. | - | logs Retrieves local logs from a job container. | - | status Returns the status of a named Snowpark Container Services job. | - +------------------------------------------------------------------------------+ - - ''' # --- # name: test_help_messages_no_help_flag[spcs.service] @@ -8293,9 +8062,8 @@ | describe Provides description of stage. | | drop Drops stage with given name. | | execute Execute immediate all files from the stage path. Files can be | - | filtered with glob like pattern, e.g. `@stage/*.sql`, | - | `@stage/dev/*`. Only files with `.sql` extension will be | - | executed. | + | filtered with glob like pattern, e.g. @stage/*.sql, | + | @stage/dev/*. Only files with .sql extension will be executed. | | list Lists all available stages. | | list-files Lists the stage contents. | | remove Removes a file from a stage. | @@ -8318,10 +8086,10 @@ | deploy Deploys a Streamlit app defined in the project definition file | | (snowflake.yml). By default, the command uploads environment.yml | | and any other pages or folders, if present. If you don’t specify | - | a stage name, the `streamlit` stage is used. If the specified | - | stage does not exist, the command creates it. If multiple | - | Streamlits are defined in snowflake.yml and no entity_id is | - | provided then command will raise an error. | + | a stage name, the streamlit stage is used. If the specified stage | + | does not exist, the command creates it. If multiple Streamlits | + | are defined in snowflake.yml and no entity_id is provided then | + | command will raise an error. | | describe Provides description of streamlit. | | drop Drops streamlit with given name. | | get-url Returns a URL to the specified Streamlit app | diff --git a/tests/__snapshots__/test_sql.ambr b/tests/__snapshots__/test_sql.ambr index 96431fd13e..82a475d3b1 100644 --- a/tests/__snapshots__/test_sql.ambr +++ b/tests/__snapshots__/test_sql.ambr @@ -5,12 +5,11 @@ Usage: default sql [OPTIONS] Executes Snowflake query. - Use either query, filename or input option. - Query to execute can be specified using query option, filename option (all - queries from file will be executed) or via stdin by piping output from other - command. For example `cat my.sql | snow sql -i`. - The command supports variable substitution that happens on client-side. Both - &VARIABLE or &{ VARIABLE } syntax are supported. + Use either query, filename or input option. Query to execute can be specified + using query option, filename option (all queries from file will be executed) + or via stdin by piping output from other command. For example cat my.sql | + snow sql -i. The command supports variable substitution that happens on + client-side. Both &VARIABLE or &{ VARIABLE } syntax are supported. +- Options --------------------------------------------------------------------+ | --query -q TEXT Query to execute. | @@ -28,8 +27,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -73,9 +72,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | diff --git a/tests/api/commands/__snapshots__/test_snow_typer.ambr b/tests/api/commands/__snapshots__/test_snow_typer.ambr index 2737f564fa..99bd5a6c8a 100644 --- a/tests/api/commands/__snapshots__/test_snow_typer.ambr +++ b/tests/api/commands/__snapshots__/test_snow_typer.ambr @@ -12,8 +12,8 @@ +------------------------------------------------------------------------------+ +- Connection configuration ---------------------------------------------------+ | --connection,--environment -c TEXT Name of the connection, as defined | - | in your `config.toml`. Default: | - | `default`. | + | in your config.toml. Default: | + | default. | | --account,--accountname TEXT Name assigned to your Snowflake | | account. Overrides the value | | specified for the connection. | @@ -57,9 +57,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -82,9 +82,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | @@ -129,9 +129,9 @@ +- Global configuration -------------------------------------------------------+ | --format [TABLE|JSON] Specifies the output format. | | [default: TABLE] | - | --verbose -v Displays log entries for log levels `info` | + | --verbose -v Displays log entries for log levels info | | and higher. | - | --debug Displays log entries for log levels `debug` | + | --debug Displays log entries for log levels debug | | and higher; debug logs contains additional | | information. | | --silent Turns off intermediate output to console. | diff --git a/tests/app/test_telemetry.py b/tests/app/test_telemetry.py index 12c95dc946..eb0687a15f 100644 --- a/tests/app/test_telemetry.py +++ b/tests/app/test_telemetry.py @@ -107,9 +107,6 @@ def test_executing_command_sends_telemetry_result_data( @mock.patch("snowflake.connector.connect") @mock.patch("snowflake.cli._plugins.streamlit.commands.StreamlitManager") -@mock.patch.dict( - os.environ, {"SNOWFLAKE_CLI_FEATURES_ENABLE_PROJECT_DEFINITION_V2": "true"} -) def test_executing_command_sends_project_definition_in_telemetry_data( _, mock_conn, project_directory, runner ): diff --git a/tests/nativeapp/codegen/snowpark/test_python_processor.py b/tests/nativeapp/codegen/snowpark/test_python_processor.py index bb704bcaed..303842665b 100644 --- a/tests/nativeapp/codegen/snowpark/test_python_processor.py +++ b/tests/nativeapp/codegen/snowpark/test_python_processor.py @@ -405,7 +405,13 @@ def test_process_with_collected_functions( project_definition=native_app_project_instance.native_app, project_root=local_path, ) - processor = SnowparkAnnotationProcessor(project.get_bundle_context()) + project_context = project.get_bundle_context() + processor_context = copy.copy(project_context) + processor_context.generated_root = ( + project_context.generated_root / "snowpark" + ) + processor_context.bundle_root = project_context.bundle_root / "snowpark" + processor = SnowparkAnnotationProcessor(processor_context) processor.process( artifact_to_process=native_app_project_instance.native_app.artifacts[0], processor_mapping=processor_mapping, @@ -465,7 +471,13 @@ def test_package_normalization( project_definition=native_app_project_instance.native_app, project_root=local_path, ) - processor = SnowparkAnnotationProcessor(project.get_bundle_context()) + project_context = project.get_bundle_context() + processor_context = copy.copy(project_context) + processor_context.generated_root = ( + project_context.generated_root / "snowpark" + ) + processor_context.bundle_root = project_context.bundle_root / "snowpark" + processor = SnowparkAnnotationProcessor(processor_context) processor.process( artifact_to_process=native_app_project_instance.native_app.artifacts[0], processor_mapping=processor_mapping, diff --git a/tests/nativeapp/test_v2_to_v1.py b/tests/nativeapp/test_v2_to_v1.py index d79d8a6634..a68a8c2f3d 100644 --- a/tests/nativeapp/test_v2_to_v1.py +++ b/tests/nativeapp/test_v2_to_v1.py @@ -29,8 +29,6 @@ DefinitionV20, ) -from tests.testing_utils.mock_config import mock_config_key - @pytest.mark.parametrize( "pdfv2_input, expected_pdfv1, expected_error", @@ -158,17 +156,16 @@ ], ) def test_v2_to_v1_conversions(pdfv2_input, expected_pdfv1, expected_error): - with mock_config_key("enable_project_definition_v2", True): - pdfv2 = DefinitionV20(**pdfv2_input) - if expected_error: - with pytest.raises(ClickException, match=expected_error) as err: - _pdf_v2_to_v1(pdfv2) - else: - pdfv1_actual = vars(_pdf_v2_to_v1(pdfv2)) - pdfv1_expected = vars(DefinitionV11(**expected_pdfv1)) + pdfv2 = DefinitionV20(**pdfv2_input) + if expected_error: + with pytest.raises(ClickException, match=expected_error) as err: + _pdf_v2_to_v1(pdfv2) + else: + pdfv1_actual = vars(_pdf_v2_to_v1(pdfv2)) + pdfv1_expected = vars(DefinitionV11(**expected_pdfv1)) - # Assert that the expected dict is a subset of the actual dict - assert {**pdfv1_actual, **pdfv1_expected} == pdfv1_actual + # Assert that the expected dict is a subset of the actual dict + assert {**pdfv1_actual, **pdfv1_expected} == pdfv1_actual def test_decorator_error_when_no_project_exists(): @@ -242,12 +239,11 @@ def test_decorator_error_when_no_project_exists(): ], ) def test_project_name(pdfv2_input, expected_project_name): - with mock_config_key("enable_project_definition_v2", True): - pdfv2 = DefinitionV20(**pdfv2_input) - pdfv1 = _pdf_v2_to_v1(pdfv2) + pdfv2 = DefinitionV20(**pdfv2_input) + pdfv1 = _pdf_v2_to_v1(pdfv2) - # Assert that the expected dict is a subset of the actual dict - assert pdfv1.native_app.name == expected_project_name + # Assert that the expected dict is a subset of the actual dict + assert pdfv1.native_app.name == expected_project_name @mock.patch( diff --git a/tests/project/__snapshots__/test_config.ambr b/tests/project/__snapshots__/test_config.ambr index 01dd986e7d..85e1066a44 100644 --- a/tests/project/__snapshots__/test_config.ambr +++ b/tests/project/__snapshots__/test_config.ambr @@ -764,44 +764,6 @@ 'streamlit': None, }) # --- -# name: test_fields_are_parsed_correctly[snowpark_procedures_coverage] - dict({ - 'definition_version': '1', - 'native_app': None, - 'snowpark': dict({ - 'functions': list([ - ]), - 'procedures': list([ - dict({ - 'database': None, - 'execute_as_caller': False, - 'external_access_integrations': list([ - ]), - 'handler': 'foo.func', - 'imports': list([ - ]), - 'name': 'foo', - 'returns': 'variant', - 'runtime': None, - 'schema_name': None, - 'secrets': dict({ - }), - 'signature': list([ - dict({ - 'arg_type': 'string', - 'default': None, - 'name': 'name', - }), - ]), - }), - ]), - 'project_name': 'my_snowpark_project', - 'src': 'app/', - 'stage_name': 'dev_deployment', - }), - 'streamlit': None, - }) -# --- # name: test_fields_are_parsed_correctly[streamlit_full_definition] dict({ 'definition_version': '1', diff --git a/tests/project/test_config.py b/tests/project/test_config.py index 391b612e5b..3ab2bd7ff6 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -20,7 +20,6 @@ from unittest import mock import pytest -from snowflake.cli.api.feature_flags import FeatureFlag from snowflake.cli.api.project.definition import load_project from snowflake.cli.api.project.errors import SchemaValidationError from snowflake.cli.api.project.schemas.native_app.path_mapping import PathMapping @@ -28,8 +27,6 @@ build_project_definition, ) -from tests.testing_utils.mock_config import mock_config_key - @pytest.mark.parametrize("project_definition_files", ["napp_project_1"], indirect=True) def test_napp_project_1(project_definition_files): @@ -127,12 +124,3 @@ def test_schema_is_validated_for_version(data): build_project_definition(**data) assert "is not supported in given version" in str(err.value) - - -def test_project_definition_v2_is_enabled_with_feature_flag(): - with mock_config_key("enable_project_definition_v2", True): - assert FeatureFlag.ENABLE_STREAMLIT_EMBEDDED_STAGE.is_enabled() == False - assert FeatureFlag.ENABLE_STREAMLIT_NO_CHECKOUTS.is_enabled() == False - assert FeatureFlag.ENABLE_STREAMLIT_VERSIONED_STAGE.is_enabled() == False - assert FeatureFlag.ENABLE_PROJECT_DEFINITION_V2.is_enabled() == True - build_project_definition(**{"definition_version": "2", "entities": {}}) diff --git a/tests/project/test_project_definition_v2.py b/tests/project/test_project_definition_v2.py index d6678b334e..befd384a83 100644 --- a/tests/project/test_project_definition_v2.py +++ b/tests/project/test_project_definition_v2.py @@ -14,7 +14,7 @@ from pathlib import Path import pytest -from snowflake.cli._plugins.snowpark.commands import _migrate_v1_snowpark_to_v2 +from snowflake.cli._plugins.snowpark.commands import migrate_v1_snowpark_to_v2 from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.cli.api.project.errors import SchemaValidationError from snowflake.cli.api.project.schemas.entities.entities import ( @@ -24,6 +24,7 @@ v2_entity_model_types_map, ) from snowflake.cli.api.project.schemas.entities.snowpark_entity import ( + PathMapping, SnowparkEntityModel, ) from snowflake.cli.api.project.schemas.project_definition import ( @@ -31,8 +32,6 @@ ) from snowflake.cli.api.project.schemas.snowpark.callable import _CallableBase -from tests.testing_utils.mock_config import mock_config_key - @pytest.mark.parametrize( "definition_input,expected_error", @@ -188,7 +187,12 @@ ], [ { - "defaults": {"stage": "dev", "project_name": "my_project"}, + "mixins": { + "snowpark_shared": { + "stage": "dev", + "artifacts": [{"src": "src", "dest": "my_project"}], + } + }, "entities": { "procedure1": { "type": "procedure", @@ -199,6 +203,7 @@ "runtime": "3.10", "artifacts": ["src"], "execute_as_caller": True, + "meta": {"use_mixins": ["snowpark_shared"]}, } }, }, @@ -206,7 +211,12 @@ ], [ { - "defaults": {"stage": "dev", "project_name": "my_project"}, + "mixins": { + "snowpark_shared": { + "stage": "dev", + "artifacts": [{"src": "src", "dest": "my_project"}], + } + }, "entities": { "procedure1": { "type": "procedure", @@ -214,8 +224,8 @@ "returns": "string", "signature": [{"name": "name", "type": "string"}], "runtime": "3.10", - "artifacts": ["src"], "execute_as_caller": True, + "meta": {"use_mixins": ["snowpark_shared"]}, } }, }, @@ -234,18 +244,17 @@ ) def test_project_definition_v2_schema(definition_input, expected_error): definition_input["definition_version"] = "2" - with mock_config_key("enable_project_definition_v2", True): - try: - DefinitionV20(**definition_input) - except SchemaValidationError as err: - if expected_error: - if type(expected_error) == str: - assert expected_error in str(err) - else: - for err_msg in expected_error: - assert err_msg in str(err) + try: + DefinitionV20(**definition_input) + except SchemaValidationError as err: + if expected_error: + if type(expected_error) == str: + assert expected_error in str(err) else: - raise err + for err_msg in expected_error: + assert err_msg in str(err) + else: + raise err def test_identifiers(): @@ -303,9 +312,8 @@ def test_defaults_are_applied(): }, "defaults": {"stage": "default_stage"}, } - with mock_config_key("enable_project_definition_v2", True): - project = DefinitionV20(**definition_input) - assert project.entities["pkg"].stage == "default_stage" + project = DefinitionV20(**definition_input) + assert project.entities["pkg"].stage == "default_stage" def test_defaults_do_not_override_values(): @@ -322,9 +330,8 @@ def test_defaults_do_not_override_values(): }, "defaults": {"stage": "default_stage"}, } - with mock_config_key("enable_project_definition_v2", True): - project = DefinitionV20(**definition_input) - assert project.entities["pkg"].stage == "pkg_stage" + project = DefinitionV20(**definition_input) + assert project.entities["pkg"].stage == "pkg_stage" # Verify that each entity model type has the correct "type" field @@ -360,10 +367,11 @@ def test_v1_to_v2_conversion( with project_directory(project_name) as project_dir: definition_v1 = DefinitionManager(project_dir).project_definition - definition_v2 = _migrate_v1_snowpark_to_v2(definition_v1) + definition_v2 = migrate_v1_snowpark_to_v2(definition_v1) assert definition_v2.definition_version == "2" assert ( - definition_v1.snowpark.project_name == definition_v2.defaults.project_name + definition_v1.snowpark.project_name + == definition_v2.mixins["snowpark_shared"]["artifacts"][0]["dest"] ) assert len(definition_v1.snowpark.procedures) == len( definition_v2.get_entities_by_type("procedure") @@ -372,16 +380,22 @@ def test_v1_to_v2_conversion( definition_v2.get_entities_by_type("function") ) + artifact = PathMapping( + src=Path(definition_v1.snowpark.src), + dest=definition_v1.snowpark.project_name, + ) for v1_procedure in definition_v1.snowpark.procedures: v2_procedure = definition_v2.entities.get(v1_procedure.name) assert v2_procedure - assert v2_procedure.artifacts == [Path(definition_v1.snowpark.src)] + assert v2_procedure.artifacts == [artifact] + assert "snowpark_shared" in v2_procedure.meta.use_mixins _assert_entities_are_equal(v1_procedure, v2_procedure) for v1_function in definition_v1.snowpark.functions: v2_function = definition_v2.entities.get(v1_function.name) assert v2_function - assert v2_function.artifacts == [Path(definition_v1.snowpark.src)] + assert v2_function.artifacts == [artifact] + assert "snowpark_shared" in v2_function.meta.use_mixins _assert_entities_are_equal(v1_function, v2_function) diff --git a/tests/snowpark/test_anaconda.py b/tests/snowpark/test_anaconda.py index c6aa23e01b..443f944911 100644 --- a/tests/snowpark/test_anaconda.py +++ b/tests/snowpark/test_anaconda.py @@ -12,9 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json -from unittest import mock -from unittest.mock import MagicMock, patch import pytest from snowflake.cli._plugins.snowpark.models import Requirement @@ -23,11 +20,8 @@ AnacondaPackagesManager, AvailablePackage, ) -from snowflake.connector import Error as ConnectorError from tests.snowpark.mocks import mock_available_packages_sql_result # noqa: F401 -from tests.test_data import test_data -from tests.testing_utils.fixtures import TEST_DIR ANACONDA_PACKAGES = AnacondaPackages( packages={ @@ -142,71 +136,3 @@ def test_anaconda_packages_from_sql_query(mock_available_packages_sql_result): Requirement.parse_line("snowflake.core") ) assert anaconda_packages.is_package_available(Requirement.parse_line("snowflake")) - - -@mock.patch("requests.get") -@mock.patch("snowflake.cli._app.snow_connector.connect_to_snowflake") -def test_filter_anaconda_packages_from_fallback_to_channel_data(mock_connect, mock_get): - mock_connect.side_effect = ConnectorError("test error") - - mock_response = mock.Mock() - mock_response.status_code = 200 - # load the contents of the local json file under test_data/anaconda_channel_data.json - with open(TEST_DIR / "test_data/anaconda_channel_data.json") as fh: - mock_response.json.return_value = json.load(fh) - - mock_get.return_value = mock_response - anaconda_packages_manager = AnacondaPackagesManager() - anaconda_packages = ( - anaconda_packages_manager.find_packages_available_in_snowflake_anaconda() - ) - - packages = [ - Requirement.parse("pandas==1.4.4"), - Requirement.parse("FuelSDK>=0.9.3"), - Requirement.parse("Pamela==1.0.1"), - ] - split_requirements = anaconda_packages.filter_available_packages(packages=packages) - assert len(split_requirements.in_snowflake) == 1 - assert len(split_requirements.unavailable) == 2 - assert split_requirements.in_snowflake[0].name == "pandas" - assert split_requirements.in_snowflake[0].specifier is True - assert split_requirements.in_snowflake[0].specs == [("==", "1.4.4")] - assert split_requirements.unavailable[0].name == "fuelsdk" - assert split_requirements.unavailable[0].specifier is True - assert split_requirements.unavailable[0].specs == [(">=", "0.9.3")] - assert split_requirements.unavailable[1].name == "pamela" - assert split_requirements.unavailable[1].specs == [("==", "1.0.1")] - - assert anaconda_packages.is_package_available(Requirement.parse_line("pamela")) - assert anaconda_packages.is_package_available( - Requirement.parse_line("pandas==1.4.4") - ) - - -@patch("snowflake.cli._plugins.snowpark.package.anaconda_packages.requests") -@mock.patch("snowflake.cli._app.snow_connector.connect_to_snowflake") -def test_anaconda_packages_from_fallback_to_channel_data(mock_connect, mock_requests): - mock_connect.side_effect = ConnectorError("test error") - - mock_response = MagicMock() - mock_response.status_code = 200 - mock_response.json.return_value = test_data.anaconda_response - mock_requests.get.return_value = mock_response - - anaconda_packages_manager = AnacondaPackagesManager() - anaconda_packages = ( - anaconda_packages_manager.find_packages_available_in_snowflake_anaconda() - ) - - assert anaconda_packages.is_package_available(Requirement.parse_line("streamlit")) - - anaconda_packages = anaconda_packages.filter_available_packages(test_data.packages) - assert ( - Requirement.parse_line("snowflake-connector-python") - in anaconda_packages.in_snowflake - ) - assert ( - Requirement.parse_line("my-totally-awesome-package") - in anaconda_packages.unavailable - ) diff --git a/tests/streamlit/conftest.py b/tests/streamlit/conftest.py deleted file mode 100644 index 96e16f923d..0000000000 --- a/tests/streamlit/conftest.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2024 Snowflake Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - - -@pytest.fixture(autouse=True) -def global_setup(monkeypatch): - monkeypatch.setenv("SNOWFLAKE_CLI_FEATURES_ENABLE_PROJECT_DEFINITION_V2", "true") diff --git a/tests/test_data/projects/migration_snowpark_V1_to_V2/app.py b/tests/test_data/projects/migration_snowpark_V1_to_V2/app.py new file mode 100644 index 0000000000..0c336bf90f --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V1_to_V2/app.py @@ -0,0 +1,16 @@ +from __future__ import annotations + +import sys + + +def hello(name: str) -> str: + return f"Hello {name}!" + + +# For local debugging. Be aware you may need to type-convert arguments if +# you add input parameters +if __name__ == "__main__": + if len(sys.argv) > 1: + print(hello(sys.argv[1])) # type: ignore + else: + print(hello("world")) diff --git a/tests/test_data/projects/migration_snowpark_V1_to_V2/requirements.txt b/tests/test_data/projects/migration_snowpark_V1_to_V2/requirements.txt new file mode 100644 index 0000000000..ed706cf032 --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V1_to_V2/requirements.txt @@ -0,0 +1 @@ +snowflake-snowpark-python diff --git a/tests/test_data/projects/migration_snowpark_V1_to_V2/snowflake.yml b/tests/test_data/projects/migration_snowpark_V1_to_V2/snowflake.yml new file mode 100644 index 0000000000..53be159a4e --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V1_to_V2/snowflake.yml @@ -0,0 +1,23 @@ +definition_version: 1 +snowpark: + project_name: "my_snowpark_project" + stage_name: "dev_deployment" + src: "app/" + functions: + - name: func1 + handler: "app.func1_handler" + signature: + - name: "a" + type: "string" + default: "default value" + - name: "b" + type: "variant" + returns: string + runtime: 3.10 + procedures: + - name: procedureName + handler: "hello" + signature: + - name: "name" + type: "string" + returns: string diff --git a/tests/test_data/projects/migration_snowpark_V2/app.py b/tests/test_data/projects/migration_snowpark_V2/app.py new file mode 100644 index 0000000000..3cdb8feab8 --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V2/app.py @@ -0,0 +1,22 @@ +from __future__ import annotations + +import sys + +from snowflake.snowpark import Session + + +def hello(name: str) -> str: + return f"Hello {name}!" + + +def test(session: Session) -> str: + return "Test procedure" + + +# For local debugging. Be aware you may need to type-convert arguments if +# you add input parameters +if __name__ == "__main__": + if len(sys.argv) > 1: + print(hello(sys.argv[1])) # type: ignore + else: + print(hello("world")) diff --git a/tests/test_data/projects/migration_snowpark_V2/requirements.txt b/tests/test_data/projects/migration_snowpark_V2/requirements.txt new file mode 100644 index 0000000000..ed706cf032 --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V2/requirements.txt @@ -0,0 +1 @@ +snowflake-snowpark-python diff --git a/tests/test_data/projects/migration_snowpark_V2/snowflake.yml b/tests/test_data/projects/migration_snowpark_V2/snowflake.yml new file mode 100644 index 0000000000..a59c6b044d --- /dev/null +++ b/tests/test_data/projects/migration_snowpark_V2/snowflake.yml @@ -0,0 +1,26 @@ +definition_version: 2 +entities: + test_procedure: + artifacts: + - app/ + handler: hello + identifier: + name: test_procedure + returns: string + signature: + - name: "name" + type: "string" + stage: dev_deployment + type: procedure + test_function: + artifacts: + - app/ + handler: hello + identifier: + name: test_procedure + returns: string + signature: + - name: "name" + type: "string" + stage: dev_deployment + type: function diff --git a/tests/test_data/projects/migration_streamlit_V1_to_V2/environment.yml b/tests/test_data/projects/migration_streamlit_V1_to_V2/environment.yml new file mode 100644 index 0000000000..ac8feac3e8 --- /dev/null +++ b/tests/test_data/projects/migration_streamlit_V1_to_V2/environment.yml @@ -0,0 +1,5 @@ +name: sf_env +channels: + - snowflake +dependencies: + - pandas diff --git a/tests/test_data/projects/migration_streamlit_V1_to_V2/pages/my_page.py b/tests/test_data/projects/migration_streamlit_V1_to_V2/pages/my_page.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/test_data/projects/migration_streamlit_V1_to_V2/snowflake.yml b/tests/test_data/projects/migration_streamlit_V1_to_V2/snowflake.yml new file mode 100644 index 0000000000..8196be580f --- /dev/null +++ b/tests/test_data/projects/migration_streamlit_V1_to_V2/snowflake.yml @@ -0,0 +1,7 @@ +definition_version: 1 +streamlit: + name: test_streamlit + stage: streamlit + query_warehouse: test_warehouse + main_file: "streamlit_app.py" + title: "My Fancy Streamlit" diff --git a/tests/test_data/projects/migration_streamlit_V1_to_V2/streamlit_app.py b/tests/test_data/projects/migration_streamlit_V1_to_V2/streamlit_app.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/test_data/projects/migration_streamlit_V2/environment.yml b/tests/test_data/projects/migration_streamlit_V2/environment.yml new file mode 100644 index 0000000000..ac8feac3e8 --- /dev/null +++ b/tests/test_data/projects/migration_streamlit_V2/environment.yml @@ -0,0 +1,5 @@ +name: sf_env +channels: + - snowflake +dependencies: + - pandas diff --git a/tests/test_data/projects/migration_streamlit_V2/pages/my_page.py b/tests/test_data/projects/migration_streamlit_V2/pages/my_page.py new file mode 100644 index 0000000000..aca2d409cf --- /dev/null +++ b/tests/test_data/projects/migration_streamlit_V2/pages/my_page.py @@ -0,0 +1 @@ +# example page file diff --git a/tests/test_data/projects/migration_streamlit_V2/snowflake.yml b/tests/test_data/projects/migration_streamlit_V2/snowflake.yml new file mode 100644 index 0000000000..708f98130c --- /dev/null +++ b/tests/test_data/projects/migration_streamlit_V2/snowflake.yml @@ -0,0 +1,15 @@ +definition_version: 2 +entities: + test_streamlit: + artifacts: + - streamlit_app.py + - environment.yml + - pages + identifier: + name: test_streamlit + main_file: streamlit_app.py + pages_dir: None + query_warehouse: test_warehouse + stage: streamlit + title: My Fancy Streamlit + type: streamlit diff --git a/tests/test_data/projects/migration_streamlit_V2/streamlit_app.py b/tests/test_data/projects/migration_streamlit_V2/streamlit_app.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/test_data/projects/snowpark_templated_v1/requirements.txt b/tests/test_data/projects/snowpark_templated_v1/requirements.txt new file mode 100644 index 0000000000..ed706cf032 --- /dev/null +++ b/tests/test_data/projects/snowpark_templated_v1/requirements.txt @@ -0,0 +1 @@ +snowflake-snowpark-python diff --git a/tests/test_data/projects/snowpark_templated_v1/snowflake.yml b/tests/test_data/projects/snowpark_templated_v1/snowflake.yml new file mode 100644 index 0000000000..25884d6304 --- /dev/null +++ b/tests/test_data/projects/snowpark_templated_v1/snowflake.yml @@ -0,0 +1,25 @@ +definition_version: "1.1" +snowpark: + project_name: "" + stage_name: "" + src: <% ctx.env.project_source %> + functions: + - name: hello_function + handler: "functions.hello_function" + signature: + - name: "name" + type: "string" + returns: string + procedures: + - name: hello_procedure + handler: "procedures.hello_procedure" + signature: + - name: "name" + type: "string" + returns: string + - name: test_procedure + handler: "procedures.test_procedure" + signature: "" + returns: string +env: + project_source: "app/" diff --git a/tests/test_data/projects/streamlit_templated_v1/common/hello.py b/tests/test_data/projects/streamlit_templated_v1/common/hello.py new file mode 100644 index 0000000000..ecf4f843f8 --- /dev/null +++ b/tests/test_data/projects/streamlit_templated_v1/common/hello.py @@ -0,0 +1,2 @@ +def say_hello(): + return "Hello!" diff --git a/tests/test_data/projects/streamlit_templated_v1/environment.yml b/tests/test_data/projects/streamlit_templated_v1/environment.yml new file mode 100644 index 0000000000..fafbe1709c --- /dev/null +++ b/tests/test_data/projects/streamlit_templated_v1/environment.yml @@ -0,0 +1,6 @@ +name: sf_env +channels: + - snowflake +dependencies: + - streamlit + - snowflake-snowpark-python diff --git a/tests/test_data/projects/streamlit_templated_v1/pages/my_page.py b/tests/test_data/projects/streamlit_templated_v1/pages/my_page.py new file mode 100644 index 0000000000..bc3ecbccba --- /dev/null +++ b/tests/test_data/projects/streamlit_templated_v1/pages/my_page.py @@ -0,0 +1,3 @@ +import streamlit as st + +st.title("Example page") diff --git a/tests/test_data/projects/streamlit_templated_v1/snowflake.yml b/tests/test_data/projects/streamlit_templated_v1/snowflake.yml new file mode 100644 index 0000000000..0d3d1253a1 --- /dev/null +++ b/tests/test_data/projects/streamlit_templated_v1/snowflake.yml @@ -0,0 +1,13 @@ +definition_version: "1.1" +streamlit: + name: + stage: + query_warehouse: + main_file: streamlit_app.py + env_file: environment.yml + pages_dir: pages/ + title: <% ctx.env.streamlit_title %> + additional_source_files: + - common/hello.py +env: + streamlit_title: "My Fancy Streamlit" diff --git a/tests/test_data/projects/streamlit_templated_v1/streamlit_app.py b/tests/test_data/projects/streamlit_templated_v1/streamlit_app.py new file mode 100644 index 0000000000..234a47273c --- /dev/null +++ b/tests/test_data/projects/streamlit_templated_v1/streamlit_app.py @@ -0,0 +1,4 @@ +import streamlit as st +from common.hello import say_hello + +st.title(f"Example streamlit app. {say_hello()}") diff --git a/tests/workspace/__snapshots__/test_manager.ambr b/tests/workspace/__snapshots__/test_manager.ambr new file mode 100644 index 0000000000..d0bc2a961a --- /dev/null +++ b/tests/workspace/__snapshots__/test_manager.ambr @@ -0,0 +1,260 @@ +# serializer version: 1 +# name: test_if_template_is_not_rendered_during_migration_with_option_checked[snowpark_templated_v1] + ''' + definition_version: '2' + entities: + hello_function: + artifacts: + - dest: + src: <% ctx.env.project_source %> + external_access_integrations: [] + handler: functions.hello_function + identifier: + name: hello_function + imports: [] + meta: + use_mixins: + - snowpark_shared + returns: string + secrets: {} + signature: + - name: name + type: string + stage: + type: function + hello_procedure: + artifacts: + - dest: + src: <% ctx.env.project_source %> + execute_as_caller: false + external_access_integrations: [] + handler: procedures.hello_procedure + identifier: + name: hello_procedure + imports: [] + meta: + use_mixins: + - snowpark_shared + returns: string + secrets: {} + signature: + - name: name + type: string + stage: + type: procedure + test_procedure: + artifacts: + - dest: + src: <% ctx.env.project_source %> + execute_as_caller: false + external_access_integrations: [] + handler: procedures.test_procedure + identifier: + name: test_procedure + imports: [] + meta: + use_mixins: + - snowpark_shared + returns: string + secrets: {} + signature: '' + stage: + type: procedure + env: + project_source: app/ + mixins: + snowpark_shared: + artifacts: + - dest: + src: <% ctx.env.project_source %> + stage: + + ''' +# --- +# name: test_if_template_is_not_rendered_during_migration_with_option_checked[snowpark_templated_v1].1 + ''' + definition_version: "1.1" + snowpark: + project_name: "" + stage_name: "" + src: <% ctx.env.project_source %> + functions: + - name: hello_function + handler: "functions.hello_function" + signature: + - name: "name" + type: "string" + returns: string + procedures: + - name: hello_procedure + handler: "procedures.hello_procedure" + signature: + - name: "name" + type: "string" + returns: string + - name: test_procedure + handler: "procedures.test_procedure" + signature: "" + returns: string + env: + project_source: "app/" + + ''' +# --- +# name: test_if_template_is_not_rendered_during_migration_with_option_checked[streamlit_templated_v1] + ''' + definition_version: '2' + entities: + : + artifacts: + - streamlit_app.py + - environment.yml + - pages + - common/hello.py + identifier: + name: + main_file: streamlit_app.py + pages_dir: pages + query_warehouse: + stage: + title: <% ctx.env.streamlit_title %> + type: streamlit + env: + streamlit_title: My Fancy Streamlit + + ''' +# --- +# name: test_if_template_is_not_rendered_during_migration_with_option_checked[streamlit_templated_v1].1 + ''' + definition_version: "1.1" + streamlit: + name: + stage: + query_warehouse: + main_file: streamlit_app.py + env_file: environment.yml + pages_dir: pages/ + title: <% ctx.env.streamlit_title %> + additional_source_files: + - common/hello.py + env: + streamlit_title: "My Fancy Streamlit" + + ''' +# --- +# name: test_migration_v1_to_v2[migration_snowpark_V1_to_V2] + ''' + definition_version: '2' + entities: + func1: + artifacts: + - dest: my_snowpark_project + src: app + external_access_integrations: [] + handler: app.func1_handler + identifier: + name: func1 + imports: [] + meta: + use_mixins: + - snowpark_shared + returns: string + runtime: '3.10' + secrets: {} + signature: + - default: default value + name: a + type: string + - name: b + type: variant + stage: dev_deployment + type: function + procedureName: + artifacts: + - dest: my_snowpark_project + src: app + execute_as_caller: false + external_access_integrations: [] + handler: hello + identifier: + name: procedureName + imports: [] + meta: + use_mixins: + - snowpark_shared + returns: string + secrets: {} + signature: + - name: name + type: string + stage: dev_deployment + type: procedure + mixins: + snowpark_shared: + artifacts: + - dest: my_snowpark_project + src: app/ + stage: dev_deployment + + ''' +# --- +# name: test_migration_v1_to_v2[migration_snowpark_V1_to_V2].1 + ''' + definition_version: 1 + snowpark: + project_name: "my_snowpark_project" + stage_name: "dev_deployment" + src: "app/" + functions: + - name: func1 + handler: "app.func1_handler" + signature: + - name: "a" + type: "string" + default: "default value" + - name: "b" + type: "variant" + returns: string + runtime: 3.10 + procedures: + - name: procedureName + handler: "hello" + signature: + - name: "name" + type: "string" + returns: string + + ''' +# --- +# name: test_migration_v1_to_v2[migration_streamlit_V1_to_V2] + ''' + definition_version: '2' + entities: + test_streamlit: + artifacts: + - streamlit_app.py + - environment.yml + - pages + identifier: + name: test_streamlit + main_file: streamlit_app.py + pages_dir: None + query_warehouse: test_warehouse + stage: streamlit + title: My Fancy Streamlit + type: streamlit + + ''' +# --- +# name: test_migration_v1_to_v2[migration_streamlit_V1_to_V2].1 + ''' + definition_version: 1 + streamlit: + name: test_streamlit + stage: streamlit + query_warehouse: test_warehouse + main_file: "streamlit_app.py" + title: "My Fancy Streamlit" + + ''' +# --- diff --git a/tests/workspace/test_manager.py b/tests/workspace/test_manager.py index 569d9a35a7..312b382362 100644 --- a/tests/workspace/test_manager.py +++ b/tests/workspace/test_manager.py @@ -13,7 +13,9 @@ # limitations under the License. from __future__ import annotations +import logging import os +from pathlib import Path from unittest import mock import pytest @@ -78,3 +80,61 @@ def test_bundle_of_invalid_entity_type(temp_dir): ValueError, match='This entity type does not support "action_bundle"' ): ws_manager.perform_action("app", EntityActions.BUNDLE) + + +@pytest.mark.parametrize( + "project_directory_name", + ["migration_streamlit_V1_to_V2", "migration_snowpark_V1_to_V2"], +) +def test_migration_v1_to_v2( + runner, project_directory, snapshot, project_directory_name +): + with project_directory(project_directory_name): + result = runner.invoke(["ws", "migrate"]) + + assert result.exit_code == 0 + assert "Project definition migrated to version 2." in result.output + assert Path("snowflake.yml").read_text() == snapshot + assert Path("snowflake_V1.yml").read_text() == snapshot + + +@pytest.mark.parametrize( + "project_directory_name", ["migration_streamlit_V2", "migration_snowpark_V2"] +) +def test_migration_already_v2(runner, project_directory, project_directory_name): + with project_directory(project_directory_name): + result = runner.invoke(["ws", "migrate"]) + + assert result.exit_code == 0 + assert "Project definition is already at version 2." in result.output + + +@pytest.mark.parametrize( + "project_directory_name", ["snowpark_templated_v1", "streamlit_templated_v1"] +) +def test_if_template_is_not_rendered_during_migration_with_option_checked( + runner, project_directory, project_directory_name, os_agnostic_snapshot, caplog +): + with project_directory(project_directory_name): + with caplog.at_level(logging.WARNING): + result = runner.invoke(["ws", "migrate", "--accept-templates"]) + + assert result.exit_code == 0 + assert Path("snowflake.yml").read_text() == os_agnostic_snapshot + assert Path("snowflake_V1.yml").read_text() == os_agnostic_snapshot + assert ( + "Your V1 definition contains templates. We cannot guarantee the correctness of the migration." + in caplog.text + ) + + +@pytest.mark.parametrize( + "project_directory_name", ["snowpark_templated_v1", "streamlit_templated_v1"] +) +def test_if_template_raises_error_during_migrations( + runner, project_directory, project_directory_name, os_agnostic_snapshot +): + with project_directory(project_directory_name): + result = runner.invoke(["ws", "migrate"]) + assert result.exit_code == 1 + assert "Project definition contains templates" in result.output diff --git a/tests_e2e/__snapshots__/test_installation.ambr b/tests_e2e/__snapshots__/test_installation.ambr index 4be22a5b6b..a99e2982cb 100644 --- a/tests_e2e/__snapshots__/test_installation.ambr +++ b/tests_e2e/__snapshots__/test_installation.ambr @@ -44,6 +44,7 @@ | sql Executes Snowflake query. | | stage Manages stages. | | streamlit Manages a Streamlit app in Snowflake. | + | ws Deploy and interact with snowflake.yml-based entities. | +------------------------------------------------------------------------------+ diff --git a/tests_integration/conftest.py b/tests_integration/conftest.py index 083ec75259..429bc015b6 100644 --- a/tests_integration/conftest.py +++ b/tests_integration/conftest.py @@ -223,11 +223,6 @@ def isolate_snowflake_home(snowflake_home): yield snowflake_home -@pytest.fixture(autouse=True) -def env_setup(monkeypatch): - monkeypatch.setenv("SNOWFLAKE_CLI_FEATURES_ENABLE_PROJECT_DEFINITION_V2", "true") - - @pytest.fixture def default_username(): return "snowflake" diff --git a/tests_integration/nativeapp/test_bundle.py b/tests_integration/nativeapp/test_bundle.py index fc4f665450..943aab287c 100644 --- a/tests_integration/nativeapp/test_bundle.py +++ b/tests_integration/nativeapp/test_bundle.py @@ -17,7 +17,6 @@ import yaml from tests.project.fixtures import * -from tests_integration.test_utils import enable_definition_v2_feature_flag from tests_integration.testing_utils import ( assert_that_result_failed_with_message_containing, ) @@ -26,20 +25,19 @@ @pytest.fixture(scope="function", params=["napp_init_v1", "napp_init_v2"]) def template_setup(runner, nativeapp_project_directory, request): test_project = request.param - with enable_definition_v2_feature_flag: - with nativeapp_project_directory(test_project) as project_root: - # Vanilla bundle on the unmodified template - result = runner.invoke_json(["app", "bundle"]) - assert result.exit_code == 0 + with nativeapp_project_directory(test_project) as project_root: + # Vanilla bundle on the unmodified template + result = runner.invoke_json(["app", "bundle"]) + assert result.exit_code == 0 - # The newly created deploy_root is explicitly deleted here, as bundle should take care of it. + # The newly created deploy_root is explicitly deleted here, as bundle should take care of it. - deploy_root = Path(project_root, "output", "deploy") - assert Path(deploy_root, "manifest.yml").is_file() - assert Path(deploy_root, "setup_script.sql").is_file() - assert Path(deploy_root, "README.md").is_file() + deploy_root = Path(project_root, "output", "deploy") + assert Path(deploy_root, "manifest.yml").is_file() + assert Path(deploy_root, "setup_script.sql").is_file() + assert Path(deploy_root, "README.md").is_file() - yield project_root, runner, test_project + yield project_root, runner, test_project def override_snowflake_yml_artifacts( diff --git a/tests_integration/nativeapp/test_debug_mode.py b/tests_integration/nativeapp/test_debug_mode.py index 6de8e21033..fe8d1124e0 100644 --- a/tests_integration/nativeapp/test_debug_mode.py +++ b/tests_integration/nativeapp/test_debug_mode.py @@ -19,7 +19,8 @@ from snowflake.connector.errors import ProgrammingError from tests.project.fixtures import * -from tests_integration.test_utils import pushd, enable_definition_v2_feature_flag + +from tests_integration.test_utils import pushd class ApplicationNotFoundError(Exception): @@ -81,7 +82,6 @@ def set_yml_application_debug(snowflake_yml: Path, debug: Optional[bool]): # Tests that debug mode is enabled by default on create, but not changed # on upgrade without an explicit setting in snowflake.yml @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) diff --git a/tests_integration/nativeapp/test_deploy.py b/tests_integration/nativeapp/test_deploy.py index e028cff91e..57214c28a8 100644 --- a/tests_integration/nativeapp/test_deploy.py +++ b/tests_integration/nativeapp/test_deploy.py @@ -23,7 +23,6 @@ contains_row_with, not_contains_row_with, row_from_snowflake_session, - enable_definition_v2_feature_flag, ) from tests_integration.testing_utils import ( assert_that_result_failed_with_message_containing, @@ -45,7 +44,6 @@ def _sanitize_deploy_output(output): # Tests a simple flow of executing "snow app deploy", verifying that an application package was created, and an application was not @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy( test_project, @@ -100,7 +98,6 @@ def test_nativeapp_deploy( @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "command,contains,not_contains", [ @@ -157,7 +154,6 @@ def test_nativeapp_deploy_prune( # Tests a simple flow of executing "snow app deploy [files]", verifying that only the specified files are synced to the stage @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_files( test_project, @@ -197,7 +193,6 @@ def test_nativeapp_deploy_files( # Tests that files inside of a symlinked directory are deployed @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_nested_directories( test_project, @@ -232,7 +227,6 @@ def test_nativeapp_deploy_nested_directories( # Tests that deploying a directory recursively syncs all of its contents @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_directory( test_project, @@ -267,7 +261,6 @@ def test_nativeapp_deploy_directory( # Tests that deploying a directory without specifying -r returns an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_directory_no_recursive( test_project, @@ -284,7 +277,6 @@ def test_nativeapp_deploy_directory_no_recursive( # Tests that specifying an unknown path to deploy results in an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_unknown_path( test_project, @@ -301,7 +293,6 @@ def test_nativeapp_deploy_unknown_path( # Tests that specifying a path with no deploy artifact results in an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_path_with_no_mapping( test_project, @@ -318,7 +309,6 @@ def test_nativeapp_deploy_path_with_no_mapping( # Tests that specifying a path and pruning result in an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_rejects_pruning_when_path_is_specified( test_project, @@ -339,7 +329,6 @@ def test_nativeapp_deploy_rejects_pruning_when_path_is_specified( # Tests that specifying a path with no direct mapping falls back to search for prefix matches @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "test_project", ["napp_deploy_prefix_matches_v1", "napp_deploy_prefix_matches_v2"] ) @@ -425,7 +414,6 @@ def test_nativeapp_deploy_looks_for_prefix_matches( # Tests that snow app deploy -r . deploys all changes @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_deploy_dot( test_project, diff --git a/tests_integration/nativeapp/test_events.py b/tests_integration/nativeapp/test_events.py index 849ddfde5e..fe846cd5c2 100644 --- a/tests_integration/nativeapp/test_events.py +++ b/tests_integration/nativeapp/test_events.py @@ -13,13 +13,12 @@ # limitations under the License. from tests.project.fixtures import * -from tests_integration.test_utils import enable_definition_v2_feature_flag + from tests_integration.testing_utils import assert_that_result_is_usage_error # Tests that snow app events with incompatible flags exits with an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) @pytest.mark.parametrize( ["flag_names", "command"], @@ -53,7 +52,6 @@ def test_app_events_mutually_exclusive_options( # Tests that snow app events without paired flags exits with an error @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) @pytest.mark.parametrize( ["flag_names", "command"], @@ -82,7 +80,6 @@ def test_app_events_paired_options( @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_app_events_reject_invalid_type( test_project, runner, nativeapp_project_directory diff --git a/tests_integration/nativeapp/test_init_run.py b/tests_integration/nativeapp/test_init_run.py index d9925b88ff..a47ca647f8 100644 --- a/tests_integration/nativeapp/test_init_run.py +++ b/tests_integration/nativeapp/test_init_run.py @@ -22,13 +22,11 @@ contains_row_with, not_contains_row_with, row_from_snowflake_session, - enable_definition_v2_feature_flag, ) # Tests a simple flow of initiating a new project, executing snow app run and teardown, all with distribution=internal @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_init_run_without_modifications( test_project, @@ -66,7 +64,6 @@ def test_nativeapp_init_run_without_modifications( # Tests a simple flow of an existing project, but executing snow app run and teardown, all with distribution=internal @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) @@ -129,7 +126,6 @@ def test_nativeapp_run_existing( # Tests a simple flow of initiating a project, executing snow app run and teardown, all with distribution=internal @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_init_run_handles_spaces( test_project, @@ -167,7 +163,6 @@ def test_nativeapp_init_run_handles_spaces( # Tests a simple flow of an existing project, but executing snow app run and teardown, all with distribution=external @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_external", "integration_external_v2"], @@ -245,7 +240,6 @@ def test_nativeapp_run_existing_w_external( # Verifies that running "app run" after "app deploy" upgrades the app @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_run_after_deploy( test_project, nativeapp_project_directory, runner, default_username, resource_suffix @@ -318,7 +312,6 @@ def test_nativeapp_init_from_repo_with_single_template( # Tests running an app whose package was dropped externally (requires dropping and recreating the app) @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) @@ -425,7 +418,6 @@ def test_nativeapp_run_orphan( # run configurations as long as we pass the --force flag to "app run" # TODO: add back all parameterizations and implement --force for "app teardown" @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) @pytest.mark.parametrize( "run_args_from, run_args_to", diff --git a/tests_integration/nativeapp/test_large_upload.py b/tests_integration/nativeapp/test_large_upload.py index 126c51e857..da943ad912 100644 --- a/tests_integration/nativeapp/test_large_upload.py +++ b/tests_integration/nativeapp/test_large_upload.py @@ -23,8 +23,7 @@ from snowflake.cli._plugins.stage.md5 import parse_multipart_md5sum from tests.project.fixtures import * -from tests_integration.test_utils import pushd, enable_definition_v2_feature_flag - +from tests_integration.test_utils import pushd THRESHOLD_BYTES: int | None = None # if set, passes this option with PUT TEMP_FILE_SIZE_BYTES = 200 * 1024 * 1024 @@ -34,7 +33,6 @@ reason="Requires AWS + python connector to support threshold=" ) @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) diff --git a/tests_integration/nativeapp/test_open.py b/tests_integration/nativeapp/test_open.py index 91465847f0..ec76dae2ee 100644 --- a/tests_integration/nativeapp/test_open.py +++ b/tests_integration/nativeapp/test_open.py @@ -15,11 +15,9 @@ from unittest import mock from tests.project.fixtures import * -from tests_integration.test_utils import enable_definition_v2_feature_flag @pytest.mark.integration -@enable_definition_v2_feature_flag @mock.patch("typer.launch") @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_open( diff --git a/tests_integration/nativeapp/test_post_deploy.py b/tests_integration/nativeapp/test_post_deploy.py index fe3f9d4e57..713d8848af 100644 --- a/tests_integration/nativeapp/test_post_deploy.py +++ b/tests_integration/nativeapp/test_post_deploy.py @@ -3,7 +3,6 @@ import pytest from tests_integration.test_utils import ( - enable_definition_v2_feature_flag, row_from_snowflake_session, ) from tests_integration.testing_utils.working_directory_utils import ( @@ -63,7 +62,6 @@ def verify_pkg_post_deploy_log(snowflake_session, pkg_name, expected_rows): @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "test_project", ["napp_application_post_deploy_v1", "napp_application_post_deploy_v2"], diff --git a/tests_integration/nativeapp/test_project_templating.py b/tests_integration/nativeapp/test_project_templating.py index 89c21fbdb0..f698842906 100644 --- a/tests_integration/nativeapp/test_project_templating.py +++ b/tests_integration/nativeapp/test_project_templating.py @@ -17,13 +17,11 @@ pushd, contains_row_with, row_from_snowflake_session, - enable_definition_v2_feature_flag, ) # Tests a simple flow of native app with template reading env variables from OS @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_templated", "integration_templated_v2"], @@ -93,7 +91,6 @@ def test_nativeapp_project_templating_use_env_from_os( # Tests a simple flow of native app with template reading env variables from OS through an intermediate var @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_templated", "integration_templated_v2"], @@ -163,7 +160,6 @@ def test_nativeapp_project_templating_use_env_from_os_through_intermediate_var( # Tests a simple flow of native app with template reading default env values from project definition file @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_templated", "integration_templated_v2"], @@ -233,7 +229,6 @@ def test_nativeapp_project_templating_use_default_env_from_project( # Tests a native app with --env parameter through command line overwriting values from os env and project definition filetemplate reading env var @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_templated", "integration_templated_v2"], @@ -312,7 +307,6 @@ def test_nativeapp_project_templating_use_env_from_cli_as_highest_priority( # Tests that other native app commands still succeed with templating @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration_templated", "integration_templated_v2"], diff --git a/tests_integration/nativeapp/test_teardown.py b/tests_integration/nativeapp/test_teardown.py index 8da5e650ae..f67473e4e5 100644 --- a/tests_integration/nativeapp/test_teardown.py +++ b/tests_integration/nativeapp/test_teardown.py @@ -18,12 +18,10 @@ contains_row_with, not_contains_row_with, row_from_snowflake_session, - enable_definition_v2_feature_flag, ) @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "command,expected_error", [ @@ -132,7 +130,6 @@ def test_nativeapp_teardown_cascade( @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("force", [True, False]) @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_teardown_unowned_app( @@ -163,7 +160,6 @@ def test_nativeapp_teardown_unowned_app( @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("default_release_directive", [True, False]) @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_teardown_pkg_versions( diff --git a/tests_integration/nativeapp/test_validate.py b/tests_integration/nativeapp/test_validate.py index 50084469c6..794f890fbc 100644 --- a/tests_integration/nativeapp/test_validate.py +++ b/tests_integration/nativeapp/test_validate.py @@ -13,13 +13,9 @@ # limitations under the License. from tests.project.fixtures import * -from tests_integration.test_utils import ( - enable_definition_v2_feature_flag, -) @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_validate(test_project, nativeapp_project_directory, runner): with nativeapp_project_directory(test_project): @@ -30,7 +26,6 @@ def test_nativeapp_validate(test_project, nativeapp_project_directory, runner): @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("test_project", ["napp_init_v1", "napp_init_v2"]) def test_nativeapp_validate_failing(test_project, nativeapp_project_directory, runner): with nativeapp_project_directory(test_project): diff --git a/tests_integration/nativeapp/test_version.py b/tests_integration/nativeapp/test_version.py index 18859a705e..aa198cf50d 100644 --- a/tests_integration/nativeapp/test_version.py +++ b/tests_integration/nativeapp/test_version.py @@ -19,14 +19,10 @@ not_contains_row_with, row_from_snowflake_session, ) -from tests_integration.test_utils import ( - enable_definition_v2_feature_flag, -) # Tests a simple flow of an existing project, executing snow app version create, drop and teardown, all with distribution=internal @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) @@ -77,7 +73,6 @@ def test_nativeapp_version_create_and_drop( # Tests upgrading an app from an existing loose files installation to versioned installation. @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) @@ -128,7 +123,6 @@ def test_nativeapp_upgrade( # Make sure we can create 3+ patches on the same version @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize("project_definition_files", ["integration"], indirect=True) def test_nativeapp_version_create_3_patches( runner, @@ -175,7 +169,6 @@ def test_nativeapp_version_create_3_patches( @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) @@ -249,7 +242,6 @@ def test_nativeapp_version_create_patch_is_integer( # Tests creating a version for a package that was not created by the CLI # (doesn't have the magic CLI comment) @pytest.mark.integration -@enable_definition_v2_feature_flag @pytest.mark.parametrize( "project_definition_files", ["integration", "integration_v2"], indirect=True ) diff --git a/tests_integration/test_snowpark.py b/tests_integration/test_snowpark.py index fa1ad17e10..46691bc303 100644 --- a/tests_integration/test_snowpark.py +++ b/tests_integration/test_snowpark.py @@ -71,7 +71,7 @@ def test_snowpark_flow( expected_files = [ f"{STAGE_NAME}/my_snowpark_project/app.zip", - f"{STAGE_NAME}/my_snowpark_project/dependencies.zip", + f"{STAGE_NAME}/dependencies.zip", ] _test_steps.assert_that_only_these_files_are_staged_in_test_db( *expected_files, stage_name=STAGE_NAME @@ -373,7 +373,7 @@ def test_snowpark_with_single_dependency_having_no_other_deps( runner, _test_steps, project_directory, alter_snowflake_yml, test_database ): with project_directory("snowpark_with_single_requirements_having_no_other_deps"): - result = runner.invoke_json(["snowpark", "build"]) + result = runner.invoke_with_connection_json(["snowpark", "build"]) assert result.exit_code == 0 assert ( @@ -402,7 +402,7 @@ def test_snowpark_with_single_requirement_having_transient_deps( runner, _test_steps, project_directory, alter_snowflake_yml, test_database ): with project_directory("snowpark_with_single_requirements_having_transient_deps"): - result = runner.invoke_json(["snowpark", "build"]) + result = runner.invoke_with_connection_json(["snowpark", "build"]) assert result.exit_code == 0 files = ZipFile("dependencies.zip").namelist() @@ -435,7 +435,9 @@ def test_snowpark_commands_executed_outside_project_dir( "snowpark_with_single_requirements_having_transient_deps", subpath=project_subpath, ): - result = runner.invoke_json(["snowpark", "build", "--project", project_subpath]) + result = runner.invoke_with_connection_json( + ["snowpark", "build", "--project", project_subpath] + ) assert result.exit_code == 0 files = ZipFile(Path(project_subpath) / "dependencies.zip").namelist() @@ -808,7 +810,7 @@ def test_build_shared_libraries_error( @pytest.mark.integration def test_dependency_search_optimization( - runner, project_directory, alter_requirements_txt + runner, project_directory, alter_requirements_txt, test_database ): with project_directory("snowpark") as tmp_dir: alter_requirements_txt(tmp_dir / "requirements.txt", ["july"]) @@ -959,15 +961,15 @@ def test_snowpark_flow_v2( ) _test_steps.assert_that_only_these_files_are_staged_in_test_db( - "stage_a/my_project/app_1.zip", - "stage_a/my_project/dependencies.zip", + "stage_a/app_1.zip", + "stage_a/dependencies.zip", stage_name="stage_a", ) _test_steps.assert_that_only_these_files_are_staged_in_test_db( - f"{STAGE_NAME}/my_project/app_2.zip", - f"{STAGE_NAME}/my_project/c.py", - f"{STAGE_NAME}/my_project/dependencies.zip", + f"{STAGE_NAME}/app_2.zip", + f"{STAGE_NAME}/c.py", + f"{STAGE_NAME}/dependencies.zip", stage_name=STAGE_NAME, ) diff --git a/tests_integration/test_snowpark_external_access.py b/tests_integration/test_snowpark_external_access.py index efe367da2b..c4c64a6bf3 100644 --- a/tests_integration/test_snowpark_external_access.py +++ b/tests_integration/test_snowpark_external_access.py @@ -56,9 +56,9 @@ def test_snowpark_external_access(project_directory, _test_steps, test_database) @pytest.mark.integration def test_snowpark_upgrades_with_external_access( - project_directory, _test_steps, test_database, alter_snowflake_yml + project_directory, _test_steps, test_database, alter_snowflake_yml, runner ): - + runner.invoke_with_connection(["sql", "-q", f"use database {test_database}"]) with project_directory("snowpark") as tmp_dir: _test_steps.snowpark_build_should_zip_files(additional_files=[Path("app.zip")]) diff --git a/tests_integration/test_utils.py b/tests_integration/test_utils.py index ff66689e7e..d3b0866d7e 100644 --- a/tests_integration/test_utils.py +++ b/tests_integration/test_utils.py @@ -80,11 +80,3 @@ def not_contains_row_with(rows: List[Dict[str, Any]], values: Dict[str, Any]) -> if row.items() >= values_items: return False return True - - -enable_definition_v2_feature_flag = mock.patch.dict( - os.environ, - { - "SNOWFLAKE_CLI_FEATURES_ENABLE_PROJECT_DEFINITION_V2": "true", - }, -) diff --git a/tests_integration/testing_utils/snowpark_utils.py b/tests_integration/testing_utils/snowpark_utils.py index 0844900ce5..9551dd5a78 100644 --- a/tests_integration/testing_utils/snowpark_utils.py +++ b/tests_integration/testing_utils/snowpark_utils.py @@ -173,7 +173,7 @@ def snowpark_build_should_zip_files( additional_files.append(Path("dependencies.zip")) current_files = set(Path(".").glob("**/*")) - result = self._setup.runner.invoke_json( + result = self._setup.runner.invoke_with_connection_json( ["snowpark", "build", "--format", "JSON", *args] ) diff --git a/tests_integration/workspaces/test_validate_schema.py b/tests_integration/workspaces/test_validate_schema.py index ffe7d07bde..b16b2cbddb 100644 --- a/tests_integration/workspaces/test_validate_schema.py +++ b/tests_integration/workspaces/test_validate_schema.py @@ -13,11 +13,9 @@ # limitations under the License. import pytest -from tests_integration.test_utils import enable_definition_v2_feature_flag @pytest.mark.integration -@enable_definition_v2_feature_flag def test_validate_project_definition_v2(runner, project_directory): with project_directory("project_definition_v2"): result = runner.invoke_with_connection_json(["ws", "validate"])