snowflake-cli-labs 2.8.1__py3-none-any.whl → 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snowflake/cli/__about__.py +1 -1
- snowflake/cli/{app → _app}/__main__.py +1 -1
- snowflake/cli/{app → _app}/cli_app.py +22 -13
- snowflake/cli/{app → _app}/commands_registration/builtin_plugins.py +15 -19
- snowflake/cli/{app → _app}/commands_registration/command_plugins_loader.py +9 -9
- snowflake/cli/{app → _app}/commands_registration/commands_registration_with_callbacks.py +4 -4
- snowflake/cli/{app → _app}/commands_registration/exception_logging.py +2 -2
- snowflake/cli/{app → _app}/commands_registration/typer_registration.py +2 -2
- snowflake/cli/{app → _app}/dev/docs/commands_docs_generator.py +30 -12
- snowflake/cli/{app → _app}/dev/docs/generator.py +3 -3
- snowflake/cli/{app → _app}/dev/docs/project_definition_docs_generator.py +4 -4
- snowflake/cli/{app → _app}/dev/docs/templates/usage.rst.jinja2 +14 -4
- snowflake/cli/{app → _app}/main_typer.py +2 -2
- snowflake/cli/{app → _app}/printing.py +2 -2
- snowflake/cli/_app/secret.py +9 -0
- snowflake/cli/{app → _app}/snow_connector.py +127 -61
- snowflake/cli/{app → _app}/telemetry.py +38 -7
- snowflake/cli/_app/version_check.py +74 -0
- snowflake/cli/{plugins → _plugins}/connection/commands.py +34 -11
- snowflake/cli/_plugins/connection/plugin_spec.py +30 -0
- snowflake/cli/{plugins → _plugins}/connection/util.py +16 -0
- snowflake/cli/{plugins → _plugins}/cortex/commands.py +54 -49
- snowflake/cli/{plugins → _plugins}/cortex/constants.py +1 -1
- snowflake/cli/{plugins → _plugins}/cortex/manager.py +5 -5
- snowflake/cli/{plugins → _plugins}/cortex/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/git/commands.py +11 -7
- snowflake/cli/{plugins → _plugins}/git/manager.py +55 -9
- snowflake/cli/{plugins → _plugins}/git/plugin_spec.py +1 -1
- snowflake/cli/_plugins/helpers/commands.py +90 -0
- snowflake/cli/{plugins/notebook → _plugins/helpers}/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/init/commands.py +2 -2
- snowflake/cli/{plugins → _plugins}/init/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/nativeapp/artifacts.py +24 -9
- snowflake/cli/_plugins/nativeapp/bundle_context.py +31 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/artifact_processor.py +4 -4
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/compiler.py +37 -18
- snowflake/cli/_plugins/nativeapp/codegen/setup/native_app_setup_processor.py +249 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/setup/setup_driver.py.source +5 -2
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/snowpark/extension_function_utils.py +5 -5
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/snowpark/models.py +1 -1
- snowflake/cli/{plugins → _plugins}/nativeapp/codegen/snowpark/python_processor.py +29 -34
- snowflake/cli/_plugins/nativeapp/codegen/templates/templates_processor.py +114 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/commands.py +252 -132
- snowflake/cli/{plugins → _plugins}/nativeapp/common_flags.py +1 -1
- snowflake/cli/_plugins/nativeapp/entities/application.py +878 -0
- snowflake/cli/_plugins/nativeapp/entities/application_package.py +1392 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/exceptions.py +3 -12
- snowflake/cli/_plugins/nativeapp/manager.py +415 -0
- snowflake/cli/{plugins/connection → _plugins/nativeapp}/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/nativeapp/policy.py +3 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/project_model.py +36 -20
- snowflake/cli/_plugins/nativeapp/run_processor.py +184 -0
- snowflake/cli/_plugins/nativeapp/same_account_install_method.py +70 -0
- snowflake/cli/_plugins/nativeapp/teardown_processor.py +70 -0
- snowflake/cli/_plugins/nativeapp/v2_conversions/v2_to_v1_decorator.py +262 -0
- snowflake/cli/{plugins → _plugins}/nativeapp/version/commands.py +20 -49
- snowflake/cli/_plugins/nativeapp/version/version_processor.py +98 -0
- snowflake/cli/{plugins → _plugins}/notebook/commands.py +3 -2
- snowflake/cli/{plugins → _plugins}/notebook/manager.py +5 -5
- snowflake/cli/{plugins/nativeapp → _plugins/notebook}/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/object/command_aliases.py +4 -4
- snowflake/cli/{plugins → _plugins}/object/commands.py +4 -5
- snowflake/cli/{plugins → _plugins}/object/manager.py +36 -15
- snowflake/cli/{plugins → _plugins}/object/plugin_spec.py +1 -1
- snowflake/cli/_plugins/snowpark/commands.py +450 -0
- snowflake/cli/_plugins/snowpark/common.py +268 -0
- snowflake/cli/{plugins → _plugins}/snowpark/models.py +0 -7
- snowflake/cli/{plugins → _plugins}/snowpark/package/anaconda_packages.py +2 -36
- snowflake/cli/{plugins → _plugins}/snowpark/package/commands.py +13 -74
- snowflake/cli/{plugins → _plugins}/snowpark/package/manager.py +2 -2
- snowflake/cli/{plugins → _plugins}/snowpark/package_utils.py +5 -5
- snowflake/cli/_plugins/snowpark/plugin_spec.py +30 -0
- snowflake/cli/_plugins/snowpark/snowpark_entity.py +29 -0
- snowflake/cli/_plugins/snowpark/snowpark_entity_model.py +173 -0
- snowflake/cli/_plugins/snowpark/snowpark_project_paths.py +109 -0
- snowflake/cli/{plugins → _plugins}/snowpark/snowpark_shared.py +0 -36
- snowflake/cli/{plugins → _plugins}/snowpark/zipper.py +16 -8
- snowflake/cli/{plugins → _plugins}/spcs/__init__.py +5 -7
- snowflake/cli/{plugins → _plugins}/spcs/compute_pool/commands.py +8 -8
- snowflake/cli/{plugins → _plugins}/spcs/compute_pool/manager.py +3 -3
- snowflake/cli/{plugins → _plugins}/spcs/image_registry/commands.py +3 -3
- snowflake/cli/{plugins → _plugins}/spcs/image_repository/commands.py +6 -6
- snowflake/cli/{plugins → _plugins}/spcs/image_repository/manager.py +1 -1
- snowflake/cli/{plugins → _plugins}/spcs/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/spcs/services/commands.py +44 -11
- snowflake/cli/{plugins → _plugins}/spcs/services/manager.py +43 -5
- snowflake/cli/{plugins → _plugins}/sql/commands.py +20 -17
- snowflake/cli/{plugins → _plugins}/sql/manager.py +1 -1
- snowflake/cli/{plugins → _plugins}/sql/plugin_spec.py +1 -1
- snowflake/cli/{plugins → _plugins}/stage/commands.py +15 -14
- snowflake/cli/{plugins → _plugins}/stage/diff.py +1 -47
- snowflake/cli/{plugins → _plugins}/stage/manager.py +12 -7
- snowflake/cli/{plugins → _plugins}/stage/plugin_spec.py +1 -1
- snowflake/cli/_plugins/stage/utils.py +54 -0
- snowflake/cli/{plugins → _plugins}/streamlit/commands.py +64 -48
- snowflake/cli/{plugins → _plugins}/streamlit/manager.py +67 -69
- snowflake/cli/_plugins/streamlit/plugin_spec.py +30 -0
- snowflake/cli/_plugins/streamlit/streamlit_entity.py +12 -0
- snowflake/cli/_plugins/streamlit/streamlit_entity_model.py +66 -0
- snowflake/cli/_plugins/workspace/action_context.py +18 -0
- snowflake/cli/_plugins/workspace/commands.py +306 -0
- snowflake/cli/_plugins/workspace/manager.py +74 -0
- snowflake/cli/_plugins/workspace/plugin_spec.py +30 -0
- snowflake/cli/api/cli_global_context.py +152 -295
- snowflake/cli/api/commands/common.py +25 -0
- snowflake/cli/api/commands/decorators.py +19 -4
- snowflake/cli/api/commands/experimental_behaviour.py +2 -3
- snowflake/cli/api/commands/flags.py +127 -228
- snowflake/cli/api/commands/overrideable_parameter.py +143 -0
- snowflake/cli/api/commands/snow_typer.py +21 -11
- snowflake/cli/api/commands/utils.py +18 -0
- snowflake/cli/api/config.py +44 -12
- snowflake/cli/api/connections.py +216 -0
- snowflake/cli/api/console/abc.py +8 -3
- snowflake/cli/api/constants.py +11 -0
- snowflake/cli/api/entities/common.py +56 -0
- snowflake/cli/api/entities/utils.py +370 -0
- snowflake/cli/api/errno.py +1 -0
- snowflake/cli/api/exceptions.py +31 -5
- snowflake/cli/api/feature_flags.py +0 -1
- snowflake/cli/api/identifiers.py +28 -5
- snowflake/cli/api/metrics.py +92 -0
- snowflake/cli/api/project/definition.py +48 -6
- snowflake/cli/api/project/definition_conversion.py +400 -0
- snowflake/cli/api/project/definition_manager.py +16 -5
- snowflake/cli/api/project/project_verification.py +3 -3
- snowflake/cli/api/project/schemas/entities/common.py +91 -16
- snowflake/cli/api/project/schemas/entities/entities.py +37 -6
- snowflake/cli/api/project/schemas/project_definition.py +180 -49
- snowflake/cli/api/project/schemas/updatable_model.py +11 -3
- snowflake/cli/api/project/schemas/v1/__init__.py +0 -0
- snowflake/cli/api/project/schemas/{identifier_model.py → v1/identifier_model.py} +3 -1
- snowflake/cli/api/project/schemas/v1/native_app/__init__.py +0 -0
- snowflake/cli/api/project/schemas/{native_app → v1/native_app}/application.py +8 -9
- snowflake/cli/api/project/schemas/{native_app → v1/native_app}/native_app.py +4 -4
- snowflake/cli/api/project/schemas/{native_app → v1/native_app}/package.py +7 -1
- snowflake/cli/api/project/schemas/v1/snowpark/__init__.py +0 -0
- snowflake/cli/api/project/schemas/{snowpark → v1/snowpark}/callable.py +2 -2
- snowflake/cli/api/project/schemas/{snowpark → v1/snowpark}/snowpark.py +2 -2
- snowflake/cli/api/project/schemas/v1/streamlit/__init__.py +0 -0
- snowflake/cli/api/project/schemas/{streamlit → v1/streamlit}/streamlit.py +2 -1
- snowflake/cli/api/project/util.py +23 -6
- snowflake/cli/api/rendering/jinja.py +14 -8
- snowflake/cli/api/rendering/project_definition_templates.py +5 -1
- snowflake/cli/api/rendering/sql_templates.py +56 -11
- snowflake/cli/api/rest_api.py +11 -5
- snowflake/cli/api/secure_path.py +16 -18
- snowflake/cli/api/secure_utils.py +90 -1
- snowflake/cli/api/sql_execution.py +43 -23
- snowflake/cli/api/utils/definition_rendering.py +45 -13
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-3.0.0.dist-info}/METADATA +20 -18
- snowflake_cli_labs-3.0.0.dist-info/RECORD +242 -0
- snowflake_cli_labs-3.0.0.dist-info/entry_points.txt +2 -0
- snowflake/cli/api/commands/project_initialisation.py +0 -65
- snowflake/cli/api/commands/typer_pre_execute.py +0 -26
- snowflake/cli/api/project/schemas/entities/application_entity.py +0 -44
- snowflake/cli/api/project/schemas/entities/application_package_entity.py +0 -66
- snowflake/cli/app/build_and_push.sh +0 -8
- snowflake/cli/plugins/nativeapp/codegen/setup/native_app_setup_processor.py +0 -172
- snowflake/cli/plugins/nativeapp/init.py +0 -345
- snowflake/cli/plugins/nativeapp/manager.py +0 -823
- snowflake/cli/plugins/nativeapp/run_processor.py +0 -389
- snowflake/cli/plugins/nativeapp/teardown_processor.py +0 -301
- snowflake/cli/plugins/nativeapp/v2_conversions/v2_to_v1_decorator.py +0 -135
- snowflake/cli/plugins/nativeapp/version/version_processor.py +0 -362
- snowflake/cli/plugins/object_stage_deprecated/__init__.py +0 -15
- snowflake/cli/plugins/object_stage_deprecated/commands.py +0 -122
- snowflake/cli/plugins/object_stage_deprecated/plugin_spec.py +0 -32
- snowflake/cli/plugins/snowpark/commands.py +0 -546
- snowflake/cli/plugins/snowpark/common.py +0 -307
- snowflake/cli/plugins/snowpark/manager.py +0 -109
- snowflake/cli/plugins/snowpark/plugin_spec.py +0 -30
- snowflake/cli/plugins/snowpark/snowpark_package_paths.py +0 -65
- snowflake/cli/plugins/spcs/jobs/commands.py +0 -78
- snowflake/cli/plugins/spcs/jobs/manager.py +0 -53
- snowflake/cli/plugins/streamlit/__init__.py +0 -13
- snowflake/cli/plugins/streamlit/plugin_spec.py +0 -30
- snowflake/cli/plugins/workspace/__init__.py +0 -13
- snowflake/cli/plugins/workspace/commands.py +0 -35
- snowflake/cli/plugins/workspace/plugin_spec.py +0 -30
- snowflake/cli/templates/default_snowpark/.gitignore +0 -4
- snowflake/cli/templates/default_snowpark/app/common.py +0 -2
- snowflake/cli/templates/default_snowpark/app/functions.py +0 -15
- snowflake/cli/templates/default_snowpark/app/procedures.py +0 -22
- snowflake/cli/templates/default_snowpark/requirements.txt +0 -1
- snowflake/cli/templates/default_snowpark/snowflake.yml +0 -23
- snowflake/cli/templates/default_streamlit/.gitignore +0 -4
- snowflake/cli/templates/default_streamlit/common/hello.py +0 -2
- snowflake/cli/templates/default_streamlit/environment.yml +0 -6
- snowflake/cli/templates/default_streamlit/pages/my_page.py +0 -3
- snowflake/cli/templates/default_streamlit/snowflake.yml +0 -10
- snowflake/cli/templates/default_streamlit/streamlit_app.py +0 -4
- snowflake_cli_labs-2.8.1.dist-info/RECORD +0 -240
- snowflake_cli_labs-2.8.1.dist-info/entry_points.txt +0 -2
- /snowflake/cli/{app → _app}/__init__.py +0 -0
- /snowflake/cli/{api/project/schemas/native_app → _app/api_impl}/__init__.py +0 -0
- /snowflake/cli/{api/project/schemas/snowpark → _app/api_impl/plugin}/__init__.py +0 -0
- /snowflake/cli/{app → _app}/api_impl/plugin/plugin_config_provider_impl.py +0 -0
- /snowflake/cli/{app → _app}/commands_registration/__init__.py +0 -0
- /snowflake/cli/{app → _app}/commands_registration/threadsafe.py +0 -0
- /snowflake/cli/{app → _app}/constants.py +0 -0
- /snowflake/cli/{api/project/schemas/streamlit → _app/dev}/__init__.py +0 -0
- /snowflake/cli/{app → _app}/dev/commands_structure.py +0 -0
- /snowflake/cli/{app/api_impl → _app/dev/docs}/__init__.py +0 -0
- /snowflake/cli/{app → _app}/dev/docs/project_definition_generate_json_schema.py +0 -0
- /snowflake/cli/{app → _app}/dev/docs/template_utils.py +0 -0
- /snowflake/cli/{app → _app}/dev/docs/templates/definition_description.rst.jinja2 +0 -0
- /snowflake/cli/{app → _app}/dev/docs/templates/overview.rst.jinja2 +0 -0
- /snowflake/cli/{app → _app}/dev/pycharm_remote_debug.py +0 -0
- /snowflake/cli/{app → _app}/loggers.py +0 -0
- /snowflake/cli/{app/api_impl/plugin → _plugins}/__init__.py +0 -0
- /snowflake/cli/{app/dev → _plugins/connection}/__init__.py +0 -0
- /snowflake/cli/{app/dev/docs → _plugins/cortex}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/cortex/types.py +0 -0
- /snowflake/cli/{plugins → _plugins/git}/__init__.py +0 -0
- /snowflake/cli/{plugins/connection → _plugins/helpers}/__init__.py +0 -0
- /snowflake/cli/{plugins/cortex → _plugins/init}/__init__.py +0 -0
- /snowflake/cli/{plugins/git → _plugins/nativeapp}/__init__.py +0 -0
- /snowflake/cli/{plugins/init → _plugins/nativeapp/codegen}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/nativeapp/codegen/sandbox.py +0 -0
- /snowflake/cli/{plugins → _plugins}/nativeapp/codegen/snowpark/callback_source.py.jinja +0 -0
- /snowflake/cli/{plugins → _plugins}/nativeapp/constants.py +0 -0
- /snowflake/cli/{templates/default_snowpark/app → _plugins/nativeapp/entities}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/nativeapp/feature_flags.py +0 -0
- /snowflake/cli/{plugins → _plugins}/nativeapp/utils.py +0 -0
- /snowflake/cli/{plugins/nativeapp → _plugins/nativeapp/version}/__init__.py +0 -0
- /snowflake/cli/{plugins/nativeapp/codegen → _plugins/notebook}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/notebook/exceptions.py +0 -0
- /snowflake/cli/{plugins → _plugins}/notebook/types.py +0 -0
- /snowflake/cli/{plugins/nativeapp/version → _plugins/object}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/object/common.py +0 -0
- /snowflake/cli/{plugins/notebook → _plugins/snowpark}/__init__.py +0 -0
- /snowflake/cli/{plugins/object → _plugins/snowpark/package}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/snowpark/package/utils.py +0 -0
- /snowflake/cli/{plugins → _plugins}/spcs/common.py +0 -0
- /snowflake/cli/{plugins/snowpark → _plugins/spcs/compute_pool}/__init__.py +0 -0
- /snowflake/cli/{plugins/snowpark/package → _plugins/spcs/image_registry}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/spcs/image_registry/manager.py +0 -0
- /snowflake/cli/{plugins/spcs/compute_pool → _plugins/spcs/image_repository}/__init__.py +0 -0
- /snowflake/cli/{plugins/spcs/image_registry → _plugins/spcs/services}/__init__.py +0 -0
- /snowflake/cli/{plugins/spcs/image_repository → _plugins/sql}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/sql/snowsql_templating.py +0 -0
- /snowflake/cli/{plugins/spcs/jobs → _plugins/stage}/__init__.py +0 -0
- /snowflake/cli/{plugins → _plugins}/stage/md5.py +0 -0
- /snowflake/cli/{plugins/spcs/services → _plugins/streamlit}/__init__.py +0 -0
- /snowflake/cli/{plugins/sql → _plugins/workspace}/__init__.py +0 -0
- /snowflake/cli/{plugins/stage → api/project/schemas/entities}/__init__.py +0 -0
- /snowflake/cli/api/project/schemas/{native_app → v1/native_app}/path_mapping.py +0 -0
- /snowflake/cli/api/project/schemas/{snowpark → v1/snowpark}/argument.py +0 -0
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-3.0.0.dist-info}/WHEEL +0 -0
- {snowflake_cli_labs-2.8.1.dist-info → snowflake_cli_labs-3.0.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -17,43 +17,46 @@ from __future__ import annotations
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
from typing import List, Optional
|
|
19
19
|
|
|
20
|
-
import
|
|
20
|
+
from snowflake.cli._plugins.sql.manager import SqlManager
|
|
21
21
|
from snowflake.cli.api.commands.decorators import with_project_definition
|
|
22
22
|
from snowflake.cli.api.commands.flags import (
|
|
23
|
-
parse_key_value_variables,
|
|
24
23
|
variables_option,
|
|
25
24
|
)
|
|
25
|
+
from snowflake.cli.api.commands.overrideable_parameter import OverrideableOption
|
|
26
26
|
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
27
|
+
from snowflake.cli.api.commands.utils import parse_key_value_variables
|
|
27
28
|
from snowflake.cli.api.output.types import CommandResult, MultipleResults, QueryResult
|
|
28
|
-
from snowflake.cli.plugins.sql.manager import SqlManager
|
|
29
29
|
|
|
30
30
|
# simple Typer with defaults because it won't become a command group as it contains only one command
|
|
31
31
|
app = SnowTyperFactory()
|
|
32
32
|
|
|
33
|
+
SOURCE_EXCLUSIVE_OPTIONS_NAMES = ["query", "files", "std_in"]
|
|
34
|
+
|
|
35
|
+
SourceOption = OverrideableOption(
|
|
36
|
+
mutually_exclusive=SOURCE_EXCLUSIVE_OPTIONS_NAMES, show_default=False
|
|
37
|
+
)
|
|
38
|
+
|
|
33
39
|
|
|
34
40
|
@app.command(name="sql", requires_connection=True, no_args_is_help=True)
|
|
35
41
|
@with_project_definition(is_optional=True)
|
|
36
42
|
def execute_sql(
|
|
37
|
-
query: Optional[str] =
|
|
38
|
-
None,
|
|
39
|
-
"--query",
|
|
40
|
-
"-q",
|
|
43
|
+
query: Optional[str] = SourceOption(
|
|
44
|
+
default=None,
|
|
45
|
+
param_decls=["--query", "-q"],
|
|
41
46
|
help="Query to execute.",
|
|
42
47
|
),
|
|
43
|
-
files: Optional[List[Path]] =
|
|
44
|
-
|
|
45
|
-
"--filename",
|
|
46
|
-
"-f",
|
|
48
|
+
files: Optional[List[Path]] = SourceOption(
|
|
49
|
+
default=[],
|
|
50
|
+
param_decls=["--filename", "-f"],
|
|
47
51
|
exists=True,
|
|
48
52
|
file_okay=True,
|
|
49
53
|
dir_okay=False,
|
|
50
54
|
readable=True,
|
|
51
55
|
help="File to execute.",
|
|
52
56
|
),
|
|
53
|
-
std_in: Optional[bool] =
|
|
54
|
-
False,
|
|
55
|
-
"--stdin",
|
|
56
|
-
"-i",
|
|
57
|
+
std_in: Optional[bool] = SourceOption(
|
|
58
|
+
default=False,
|
|
59
|
+
param_decls=["--stdin", "-i"],
|
|
57
60
|
help="Read the query from standard input. Use it when piping input to this command.",
|
|
58
61
|
),
|
|
59
62
|
data_override: List[str] = variables_option(
|
|
@@ -70,9 +73,9 @@ def execute_sql(
|
|
|
70
73
|
Query to execute can be specified using query option, filename option (all queries from file will be executed)
|
|
71
74
|
or via stdin by piping output from other command. For example `cat my.sql | snow sql -i`.
|
|
72
75
|
|
|
73
|
-
The command supports variable substitution that happens on client-side.
|
|
74
|
-
syntax are supported.
|
|
76
|
+
The command supports variable substitution that happens on client-side.
|
|
75
77
|
"""
|
|
78
|
+
|
|
76
79
|
data = {}
|
|
77
80
|
if data_override:
|
|
78
81
|
data = {v.key: v.value for v in parse_key_value_variables(data_override)}
|
|
@@ -22,10 +22,10 @@ from typing import Dict, Iterable, List, Tuple
|
|
|
22
22
|
|
|
23
23
|
from click import ClickException, UsageError
|
|
24
24
|
from jinja2 import UndefinedError
|
|
25
|
+
from snowflake.cli._plugins.sql.snowsql_templating import transpile_snowsql_templates
|
|
25
26
|
from snowflake.cli.api.rendering.sql_templates import snowflake_sql_jinja_render
|
|
26
27
|
from snowflake.cli.api.secure_path import UNLIMITED, SecurePath
|
|
27
28
|
from snowflake.cli.api.sql_execution import SqlExecutionMixin, VerboseCursor
|
|
28
|
-
from snowflake.cli.plugins.sql.snowsql_templating import transpile_snowsql_templates
|
|
29
29
|
from snowflake.connector.cursor import SnowflakeCursor
|
|
30
30
|
from snowflake.connector.util_text import split_statements
|
|
31
31
|
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from snowflake.cli._plugins.sql import commands
|
|
15
16
|
from snowflake.cli.api.plugins.command import (
|
|
16
17
|
SNOWCLI_ROOT_COMMAND_PATH,
|
|
17
18
|
CommandSpec,
|
|
18
19
|
CommandType,
|
|
19
20
|
plugin_hook_impl,
|
|
20
21
|
)
|
|
21
|
-
from snowflake.cli.plugins.sql import commands
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@plugin_hook_impl
|
|
@@ -21,12 +21,23 @@ from typing import List, Optional
|
|
|
21
21
|
|
|
22
22
|
import click
|
|
23
23
|
import typer
|
|
24
|
-
from snowflake.cli.
|
|
24
|
+
from snowflake.cli._plugins.object.command_aliases import (
|
|
25
|
+
add_object_command_aliases,
|
|
26
|
+
scope_option,
|
|
27
|
+
)
|
|
28
|
+
from snowflake.cli._plugins.stage.diff import (
|
|
29
|
+
DiffResult,
|
|
30
|
+
compute_stage_diff,
|
|
31
|
+
)
|
|
32
|
+
from snowflake.cli._plugins.stage.manager import StageManager
|
|
33
|
+
from snowflake.cli._plugins.stage.utils import print_diff_to_console
|
|
34
|
+
from snowflake.cli.api.cli_global_context import get_cli_context
|
|
35
|
+
from snowflake.cli.api.commands.common import OnErrorType
|
|
25
36
|
from snowflake.cli.api.commands.flags import (
|
|
26
37
|
ExecuteVariablesOption,
|
|
27
38
|
OnErrorOption,
|
|
28
39
|
PatternOption,
|
|
29
|
-
|
|
40
|
+
identifier_stage_argument,
|
|
30
41
|
like_option,
|
|
31
42
|
)
|
|
32
43
|
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
@@ -42,23 +53,13 @@ from snowflake.cli.api.output.types import (
|
|
|
42
53
|
SingleQueryResult,
|
|
43
54
|
)
|
|
44
55
|
from snowflake.cli.api.utils.path_utils import is_stage_path
|
|
45
|
-
from snowflake.cli.plugins.object.command_aliases import (
|
|
46
|
-
add_object_command_aliases,
|
|
47
|
-
scope_option,
|
|
48
|
-
)
|
|
49
|
-
from snowflake.cli.plugins.stage.diff import (
|
|
50
|
-
DiffResult,
|
|
51
|
-
compute_stage_diff,
|
|
52
|
-
print_diff_to_console,
|
|
53
|
-
)
|
|
54
|
-
from snowflake.cli.plugins.stage.manager import OnErrorType, StageManager
|
|
55
56
|
|
|
56
57
|
app = SnowTyperFactory(
|
|
57
58
|
name="stage",
|
|
58
59
|
help="Manages stages.",
|
|
59
60
|
)
|
|
60
61
|
|
|
61
|
-
StageNameArgument =
|
|
62
|
+
StageNameArgument = identifier_stage_argument(sf_object="stage", example="@my_stage")
|
|
62
63
|
|
|
63
64
|
add_object_command_aliases(
|
|
64
65
|
app=app,
|
|
@@ -188,7 +189,7 @@ def stage_diff(
|
|
|
188
189
|
diff: DiffResult = compute_stage_diff(
|
|
189
190
|
local_root=Path(folder_name), stage_fqn=stage_name
|
|
190
191
|
)
|
|
191
|
-
if
|
|
192
|
+
if get_cli_context().output_format == OutputFormat.JSON:
|
|
192
193
|
return ObjectResult(diff.to_dict())
|
|
193
194
|
else:
|
|
194
195
|
print_diff_to_console(diff)
|
|
@@ -19,11 +19,10 @@ from dataclasses import dataclass, field
|
|
|
19
19
|
from pathlib import Path, PurePosixPath
|
|
20
20
|
from typing import Collection, Dict, List, Optional, Tuple
|
|
21
21
|
|
|
22
|
-
from snowflake.cli.
|
|
22
|
+
from snowflake.cli._plugins.nativeapp.artifacts import BundleMap
|
|
23
23
|
from snowflake.cli.api.exceptions import (
|
|
24
24
|
SnowflakeSQLExecutionError,
|
|
25
25
|
)
|
|
26
|
-
from snowflake.cli.plugins.nativeapp.artifacts import BundleMap
|
|
27
26
|
from snowflake.connector.cursor import DictCursor
|
|
28
27
|
|
|
29
28
|
from .manager import StageManager
|
|
@@ -279,48 +278,3 @@ def _to_diff_line(status: str, src: Optional[str], dest: str) -> str:
|
|
|
279
278
|
status_prefix = f"[red]{status}[/red]: {padding}"
|
|
280
279
|
|
|
281
280
|
return f"{status_prefix}{src_prefix}{dest}"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
def print_diff_to_console(
|
|
285
|
-
diff: DiffResult,
|
|
286
|
-
bundle_map: Optional[BundleMap] = None,
|
|
287
|
-
):
|
|
288
|
-
if not diff.has_changes():
|
|
289
|
-
cc.message("Your stage is up-to-date with your local deploy root.")
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
blank_line_needed = False
|
|
293
|
-
if diff.only_local or diff.different:
|
|
294
|
-
cc.message("Local changes to be deployed:")
|
|
295
|
-
messages_to_output = []
|
|
296
|
-
for p in diff.different:
|
|
297
|
-
src_dest_pair = _to_src_dest_pair(p, bundle_map)
|
|
298
|
-
messages_to_output.append(
|
|
299
|
-
(
|
|
300
|
-
src_dest_pair,
|
|
301
|
-
_to_diff_line("modified", src_dest_pair[0], src_dest_pair[1]),
|
|
302
|
-
)
|
|
303
|
-
)
|
|
304
|
-
for p in diff.only_local:
|
|
305
|
-
src_dest_pair = _to_src_dest_pair(p, bundle_map)
|
|
306
|
-
messages_to_output.append(
|
|
307
|
-
(
|
|
308
|
-
src_dest_pair,
|
|
309
|
-
_to_diff_line("added", src_dest_pair[0], src_dest_pair[1]),
|
|
310
|
-
)
|
|
311
|
-
)
|
|
312
|
-
|
|
313
|
-
with cc.indented():
|
|
314
|
-
for key, message in sorted(messages_to_output, key=lambda pair: pair[0]):
|
|
315
|
-
cc.message(message)
|
|
316
|
-
|
|
317
|
-
blank_line_needed = True
|
|
318
|
-
|
|
319
|
-
if diff.only_on_stage:
|
|
320
|
-
if blank_line_needed:
|
|
321
|
-
cc.message("")
|
|
322
|
-
cc.message(f"Deleted paths to be removed from your stage:")
|
|
323
|
-
with cc.indented():
|
|
324
|
-
for p in sorted(diff.only_on_stage):
|
|
325
|
-
diff_line = _to_diff_line("deleted", src=None, dest=str(p))
|
|
326
|
-
cc.message(diff_line)
|
|
@@ -27,11 +27,12 @@ from textwrap import dedent
|
|
|
27
27
|
from typing import Dict, List, Optional, Union
|
|
28
28
|
|
|
29
29
|
from click import ClickException
|
|
30
|
-
from snowflake.cli.
|
|
30
|
+
from snowflake.cli._plugins.snowpark.package_utils import parse_requirements
|
|
31
|
+
from snowflake.cli.api.commands.common import (
|
|
31
32
|
OnErrorType,
|
|
32
33
|
Variable,
|
|
33
|
-
parse_key_value_variables,
|
|
34
34
|
)
|
|
35
|
+
from snowflake.cli.api.commands.utils import parse_key_value_variables
|
|
35
36
|
from snowflake.cli.api.console import cli_console
|
|
36
37
|
from snowflake.cli.api.constants import PYTHON_3_12
|
|
37
38
|
from snowflake.cli.api.identifiers import FQN
|
|
@@ -39,7 +40,6 @@ from snowflake.cli.api.project.util import to_string_literal
|
|
|
39
40
|
from snowflake.cli.api.secure_path import SecurePath
|
|
40
41
|
from snowflake.cli.api.sql_execution import SqlExecutionMixin
|
|
41
42
|
from snowflake.cli.api.utils.path_utils import path_resolver
|
|
42
|
-
from snowflake.cli.plugins.snowpark.package_utils import parse_requirements
|
|
43
43
|
from snowflake.connector import DictCursor, ProgrammingError
|
|
44
44
|
from snowflake.connector.cursor import SnowflakeCursor
|
|
45
45
|
|
|
@@ -57,6 +57,9 @@ EXECUTE_SUPPORTED_FILES_FORMATS = (
|
|
|
57
57
|
".py",
|
|
58
58
|
) # tuple to preserve order but it's a set
|
|
59
59
|
|
|
60
|
+
# Replace magic numbers with constants
|
|
61
|
+
OMIT_FIRST = slice(1, None)
|
|
62
|
+
|
|
60
63
|
|
|
61
64
|
@dataclass
|
|
62
65
|
class StagePathParts:
|
|
@@ -67,7 +70,7 @@ class StagePathParts:
|
|
|
67
70
|
|
|
68
71
|
@classmethod
|
|
69
72
|
def get_directory(cls, stage_path: str) -> str:
|
|
70
|
-
return "/".join(Path(stage_path).parts[
|
|
73
|
+
return "/".join(Path(stage_path).parts[OMIT_FIRST])
|
|
71
74
|
|
|
72
75
|
@property
|
|
73
76
|
def path(self) -> str:
|
|
@@ -119,7 +122,9 @@ class DefaultStagePathParts(StagePathParts):
|
|
|
119
122
|
self.directory = self.get_directory(stage_path)
|
|
120
123
|
self.stage = StageManager.get_stage_from_path(stage_path)
|
|
121
124
|
stage_name = self.stage.split(".")[-1]
|
|
122
|
-
stage_name =
|
|
125
|
+
stage_name = (
|
|
126
|
+
stage_name[OMIT_FIRST] if stage_name.startswith("@") else stage_name
|
|
127
|
+
)
|
|
123
128
|
self.stage_name = stage_name
|
|
124
129
|
self.is_directory = True if stage_path.endswith("/") else False
|
|
125
130
|
|
|
@@ -133,7 +138,7 @@ class DefaultStagePathParts(StagePathParts):
|
|
|
133
138
|
|
|
134
139
|
def replace_stage_prefix(self, file_path: str) -> str:
|
|
135
140
|
stage = Path(self.stage).parts[0]
|
|
136
|
-
file_path_without_prefix = Path(file_path).parts[
|
|
141
|
+
file_path_without_prefix = Path(file_path).parts[OMIT_FIRST]
|
|
137
142
|
return f"{stage}/{'/'.join(file_path_without_prefix)}"
|
|
138
143
|
|
|
139
144
|
def add_stage_prefix(self, file_path: str) -> str:
|
|
@@ -461,7 +466,7 @@ class StageManager(SqlExecutionMixin):
|
|
|
461
466
|
on_error: OnErrorType,
|
|
462
467
|
) -> Dict:
|
|
463
468
|
try:
|
|
464
|
-
query = f"execute immediate from {file_stage_path}"
|
|
469
|
+
query = f"execute immediate from {self.quote_stage_name(file_stage_path)}"
|
|
465
470
|
if variables:
|
|
466
471
|
query += variables
|
|
467
472
|
self._execute_query(query)
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from snowflake.cli._plugins.stage import commands
|
|
15
16
|
from snowflake.cli.api.plugins.command import (
|
|
16
17
|
SNOWCLI_ROOT_COMMAND_PATH,
|
|
17
18
|
CommandSpec,
|
|
18
19
|
CommandType,
|
|
19
20
|
plugin_hook_impl,
|
|
20
21
|
)
|
|
21
|
-
from snowflake.cli.plugins.stage import commands
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
@plugin_hook_impl
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from snowflake.cli._plugins.nativeapp.artifacts import BundleMap
|
|
4
|
+
from snowflake.cli._plugins.stage.diff import (
|
|
5
|
+
DiffResult,
|
|
6
|
+
_to_diff_line,
|
|
7
|
+
_to_src_dest_pair,
|
|
8
|
+
)
|
|
9
|
+
from snowflake.cli.api.console import cli_console as cc
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def print_diff_to_console(
|
|
13
|
+
diff: DiffResult,
|
|
14
|
+
bundle_map: Optional[BundleMap] = None,
|
|
15
|
+
):
|
|
16
|
+
if not diff.has_changes():
|
|
17
|
+
cc.message("Your stage is up-to-date with your local deploy root.")
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
blank_line_needed = False
|
|
21
|
+
if diff.only_local or diff.different:
|
|
22
|
+
cc.message("Local changes to be deployed:")
|
|
23
|
+
messages_to_output = []
|
|
24
|
+
for p in diff.different:
|
|
25
|
+
src_dest_pair = _to_src_dest_pair(p, bundle_map)
|
|
26
|
+
messages_to_output.append(
|
|
27
|
+
(
|
|
28
|
+
src_dest_pair,
|
|
29
|
+
_to_diff_line("modified", src_dest_pair[0], src_dest_pair[1]),
|
|
30
|
+
)
|
|
31
|
+
)
|
|
32
|
+
for p in diff.only_local:
|
|
33
|
+
src_dest_pair = _to_src_dest_pair(p, bundle_map)
|
|
34
|
+
messages_to_output.append(
|
|
35
|
+
(
|
|
36
|
+
src_dest_pair,
|
|
37
|
+
_to_diff_line("added", src_dest_pair[0], src_dest_pair[1]),
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
with cc.indented():
|
|
42
|
+
for key, message in sorted(messages_to_output, key=lambda pair: pair[0]):
|
|
43
|
+
cc.message(message)
|
|
44
|
+
|
|
45
|
+
blank_line_needed = True
|
|
46
|
+
|
|
47
|
+
if diff.only_on_stage:
|
|
48
|
+
if blank_line_needed:
|
|
49
|
+
cc.message("")
|
|
50
|
+
cc.message(f"Deleted paths to be removed from your stage:")
|
|
51
|
+
with cc.indented():
|
|
52
|
+
for p in sorted(diff.only_on_stage):
|
|
53
|
+
diff_line = _to_diff_line("deleted", src=None, dest=str(p))
|
|
54
|
+
cc.message(diff_line)
|
|
@@ -16,36 +16,42 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
import logging
|
|
18
18
|
from pathlib import Path
|
|
19
|
+
from typing import Dict
|
|
19
20
|
|
|
20
21
|
import click
|
|
21
22
|
import typer
|
|
22
|
-
from click import ClickException
|
|
23
|
-
from snowflake.cli.
|
|
23
|
+
from click import ClickException, UsageError
|
|
24
|
+
from snowflake.cli._plugins.object.command_aliases import (
|
|
25
|
+
add_object_command_aliases,
|
|
26
|
+
scope_option,
|
|
27
|
+
)
|
|
28
|
+
from snowflake.cli._plugins.streamlit.manager import StreamlitManager
|
|
29
|
+
from snowflake.cli._plugins.streamlit.streamlit_entity_model import (
|
|
30
|
+
StreamlitEntityModel,
|
|
31
|
+
)
|
|
32
|
+
from snowflake.cli.api.cli_global_context import get_cli_context
|
|
24
33
|
from snowflake.cli.api.commands.decorators import (
|
|
25
34
|
with_experimental_behaviour,
|
|
26
35
|
with_project_definition,
|
|
27
36
|
)
|
|
28
37
|
from snowflake.cli.api.commands.flags import (
|
|
29
38
|
ReplaceOption,
|
|
39
|
+
entity_argument,
|
|
30
40
|
identifier_argument,
|
|
31
41
|
like_option,
|
|
32
42
|
)
|
|
33
|
-
from snowflake.cli.api.commands.project_initialisation import add_init_command
|
|
34
43
|
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
|
|
35
44
|
from snowflake.cli.api.constants import ObjectType
|
|
45
|
+
from snowflake.cli.api.exceptions import NoProjectDefinitionError
|
|
36
46
|
from snowflake.cli.api.identifiers import FQN
|
|
37
47
|
from snowflake.cli.api.output.types import (
|
|
38
48
|
CommandResult,
|
|
39
49
|
MessageResult,
|
|
40
50
|
SingleQueryResult,
|
|
41
51
|
)
|
|
42
|
-
from snowflake.cli.api.project.
|
|
43
|
-
|
|
44
|
-
from snowflake.cli.plugins.object.command_aliases import (
|
|
45
|
-
add_object_command_aliases,
|
|
46
|
-
scope_option,
|
|
52
|
+
from snowflake.cli.api.project.definition_conversion import (
|
|
53
|
+
convert_project_definition_to_v2,
|
|
47
54
|
)
|
|
48
|
-
from snowflake.cli.plugins.streamlit.manager import StreamlitManager
|
|
49
55
|
|
|
50
56
|
app = SnowTyperFactory(
|
|
51
57
|
name="streamlit",
|
|
@@ -63,12 +69,6 @@ OpenOption = typer.Option(
|
|
|
63
69
|
is_flag=True,
|
|
64
70
|
)
|
|
65
71
|
|
|
66
|
-
add_init_command(
|
|
67
|
-
app,
|
|
68
|
-
project_type="Streamlit",
|
|
69
|
-
template="default_streamlit",
|
|
70
|
-
help_message="Name of the Streamlit app project directory you want to create. Defaults to `example_streamlit`.",
|
|
71
|
-
)
|
|
72
72
|
|
|
73
73
|
add_object_command_aliases(
|
|
74
74
|
app=app,
|
|
@@ -81,11 +81,25 @@ add_object_command_aliases(
|
|
|
81
81
|
)
|
|
82
82
|
|
|
83
83
|
|
|
84
|
+
@app.command(requires_connection=True)
|
|
85
|
+
def execute(
|
|
86
|
+
name: FQN = StreamlitNameArgument,
|
|
87
|
+
**options,
|
|
88
|
+
):
|
|
89
|
+
"""
|
|
90
|
+
Executes a streamlit in a headless mode.
|
|
91
|
+
"""
|
|
92
|
+
_ = StreamlitManager().execute(app_name=name)
|
|
93
|
+
return MessageResult(f"Streamlit {name} executed.")
|
|
94
|
+
|
|
95
|
+
|
|
84
96
|
@app.command("share", requires_connection=True)
|
|
85
97
|
def streamlit_share(
|
|
86
98
|
name: FQN = StreamlitNameArgument,
|
|
87
99
|
to_role: str = typer.Argument(
|
|
88
|
-
...,
|
|
100
|
+
...,
|
|
101
|
+
help="Role with which to share the Streamlit app.",
|
|
102
|
+
show_default=False,
|
|
89
103
|
),
|
|
90
104
|
**options,
|
|
91
105
|
) -> CommandResult:
|
|
@@ -118,48 +132,50 @@ def streamlit_deploy(
|
|
|
118
132
|
replace: bool = ReplaceOption(
|
|
119
133
|
help="Replace the Streamlit app if it already exists."
|
|
120
134
|
),
|
|
135
|
+
entity_id: str = entity_argument("streamlit"),
|
|
121
136
|
open_: bool = OpenOption,
|
|
122
137
|
**options,
|
|
123
138
|
) -> CommandResult:
|
|
124
139
|
"""
|
|
125
140
|
Deploys a Streamlit app defined in the project definition file (snowflake.yml). By default, the command uploads
|
|
126
141
|
environment.yml and any other pages or folders, if present. If you don’t specify a stage name, the `streamlit`
|
|
127
|
-
stage is used. If the specified stage does not exist, the command creates it.
|
|
142
|
+
stage is used. If the specified stage does not exist, the command creates it. If multiple Streamlits are defined
|
|
143
|
+
in snowflake.yml and no entity_id is provided then command will raise an error.
|
|
128
144
|
"""
|
|
129
145
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
pages_dir = streamlit.pages_dir
|
|
143
|
-
if pages_dir and not Path(pages_dir).exists():
|
|
144
|
-
raise ClickException(f"Provided file {pages_dir} does not exist")
|
|
145
|
-
elif pages_dir is None:
|
|
146
|
-
pages_dir = "pages"
|
|
147
|
-
|
|
148
|
-
streamlit_id = FQN.from_identifier_model(streamlit).using_context()
|
|
149
|
-
|
|
150
|
-
url = StreamlitManager().deploy(
|
|
151
|
-
streamlit_id=streamlit_id,
|
|
152
|
-
environment_file=Path(environment_file),
|
|
153
|
-
pages_dir=Path(pages_dir),
|
|
154
|
-
stage_name=streamlit.stage,
|
|
155
|
-
main_file=Path(streamlit.main_file),
|
|
156
|
-
replace=replace,
|
|
157
|
-
query_warehouse=streamlit.query_warehouse,
|
|
158
|
-
additional_source_files=streamlit.additional_source_files,
|
|
159
|
-
title=streamlit.title,
|
|
160
|
-
**options,
|
|
146
|
+
cli_context = get_cli_context()
|
|
147
|
+
pd = cli_context.project_definition
|
|
148
|
+
if not pd.meets_version_requirement("2"):
|
|
149
|
+
if not pd.streamlit:
|
|
150
|
+
raise NoProjectDefinitionError(
|
|
151
|
+
project_type="streamlit", project_root=cli_context.project_root
|
|
152
|
+
)
|
|
153
|
+
pd = convert_project_definition_to_v2(cli_context.project_root, pd)
|
|
154
|
+
|
|
155
|
+
streamlits: Dict[str, StreamlitEntityModel] = pd.get_entities_by_type(
|
|
156
|
+
entity_type="streamlit"
|
|
161
157
|
)
|
|
162
158
|
|
|
159
|
+
if not streamlits:
|
|
160
|
+
raise NoProjectDefinitionError(
|
|
161
|
+
project_type="streamlit", project_root=cli_context.project_root
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
if entity_id and entity_id not in streamlits:
|
|
165
|
+
raise UsageError(f"No '{entity_id}' entity in project definition file.")
|
|
166
|
+
|
|
167
|
+
if len(streamlits.keys()) == 1:
|
|
168
|
+
entity_id = list(streamlits.keys())[0]
|
|
169
|
+
|
|
170
|
+
if entity_id is None:
|
|
171
|
+
raise UsageError(
|
|
172
|
+
"Multiple Streamlit apps found. Please provide entity id for the operation."
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Get first streamlit
|
|
176
|
+
streamlit: StreamlitEntityModel = streamlits[entity_id]
|
|
177
|
+
url = StreamlitManager().deploy(streamlit=streamlit, replace=replace)
|
|
178
|
+
|
|
163
179
|
if open_:
|
|
164
180
|
typer.launch(url)
|
|
165
181
|
|