Skip to content

Commit

Permalink
Bug fixes for Snowflake packages (#93)
Browse files Browse the repository at this point in the history
* fixing error message for snow configure

* undo debug for package upload

* surfacing when stage upload already exists

* v0.2.1
  • Loading branch information
sfc-gh-jhollan authored Mar 8, 2023
1 parent bec05b0 commit 7d350d4
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/snowcli/__about__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from __future__ import annotations

VERSION = "0.2.0"
VERSION = "0.2.1"
10 changes: 7 additions & 3 deletions src/snowcli/cli/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ def package_upload(
if env_conf is None:
print(
f"The {environment} environment is not configured in app.toml "
"yet, please run `snow configure dev` first before continuing.",
"yet, please run `snow configure` first before continuing.",
)
raise typer.Abort()
if config.isAuth():
config.connectToSnowflake()
with tempfile.TemporaryDirectory() as temp_dir:
temp_app_zip_path = utils.prepareAppZip(file, temp_dir)
config.snowflake_connection.uploadFileToStage(
deploy_response = config.snowflake_connection.uploadFileToStage(
file_path=temp_app_zip_path,
destination_stage=stage,
path="/",
Expand All @@ -124,4 +124,8 @@ def package_upload(
overwrite=overwrite,
role=env_conf["role"],
)
print(f"Package {file} uploaded to stage @{stage}/{file}.")
print(f"Package {file} {deploy_response[6]} to Snowflake @{stage}/{file}.")
if deploy_response[6] == "SKIPPED":
print(
"Package already exists on stage. Consider using --overwrite to overwrite the file."
)
2 changes: 1 addition & 1 deletion src/snowcli/cli/procedure_coverage/clear.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def procedure_coverage_clear(
if env_conf is None:
print(
f"The {environment} environment is not configured in app.toml "
"yet, please run `snow configure dev` first before continuing.",
"yet, please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()
if config.isAuth():
Expand Down
2 changes: 1 addition & 1 deletion src/snowcli/cli/procedure_coverage/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def procedure_coverage_report(
if env_conf is None:
print(
f"The {environment} environment is not configured in app.toml "
"yet, please run `snow configure dev` first before continuing.",
"yet, please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()
if config.isAuth():
Expand Down
13 changes: 7 additions & 6 deletions src/snowcli/cli/snowpark_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def snowpark_create(
if env_conf is None:
print(
f"""The {environment} environment is not configured in app.toml
yet, please run `snow configure {environment}` first before
yet, please run `snow configure -e {environment}` first before
continuing.""",
)
raise typer.Abort()
Expand Down Expand Up @@ -254,7 +254,8 @@ def snowpark_update(
role=env_conf["role"],
)
print(
f"{deploy_response} uploaded to stage " f'{deploy_dict["full_path"]}',
f"{deploy_response[0]} uploaded to stage "
f'{deploy_dict["full_path"]}',
)

if updatedPackageList or replace:
Expand Down Expand Up @@ -397,7 +398,7 @@ def snowpark_execute(type: str, environment: str, select: str):
if env_conf is None:
print(
f"The {environment} environment is not configured in app.toml "
"yet, please run `snow configure dev` first before continuing.",
"yet, please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()
if config.isAuth():
Expand Down Expand Up @@ -434,7 +435,7 @@ def snowpark_describe(
if env_conf is None:
print(
"The {environment} environment is not configured in app.toml yet, "
"please run `snow configure dev` first before continuing.",
"please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()

Expand Down Expand Up @@ -478,7 +479,7 @@ def snowpark_list(type, environment, like):
if env_conf is None:
print(
f"The {environment} environment is not configured in app.toml "
f"yet, please run `snow configure dev` first before continuing.",
f"yet, please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()
if config.isAuth():
Expand Down Expand Up @@ -515,7 +516,7 @@ def snowpark_drop(
if env_conf is None:
print(
"The {environment} environment is not configured in app.toml "
"yet, please run `snow configure dev` first before continuing.",
"yet, please run `snow configure -e dev` first before continuing.",
)
raise typer.Abort()

Expand Down
2 changes: 1 addition & 1 deletion src/snowcli/snow_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def uploadFileToStage(
"auto_compress=false overwrite="
f'{"true" if overwrite else "false"}',
)
return self.cs.fetchone()[0]
return self.cs.fetchone()

def executeFunction(
self,
Expand Down

0 comments on commit 7d350d4

Please sign in to comment.