Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to stabilize the snowpark odd errors #230

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/ui/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ def get(cls):
"schema": schema,
}

Session.builder.configs(connection_parameters).create()
cls.session = get_active_session()
cls.session = Session.builder.configs(
connection_parameters
).create()
return cls.session

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion app/ui/reports_heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def heatmap(
high = (
bf.end - datetime.timedelta(days=bf.end.weekday()) + datetime.timedelta(days=6)
)
df = connection.execute(
df = connection.execute_select(
sql, {"start": low, "end": high, "warehouse_names": bf.warehouse_names}
)
df.set_index(["PERIOD"], inplace=True)
Expand Down
2 changes: 1 addition & 1 deletion app/ui/reports_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def warehouse_users(container):
group by warehouse_id, warehouse_name, st_period;
"""

df = connection.execute(
df = connection.execute_select(
sql,
{"start": bf.start, "end": bf.end, "warehouse_names": bf.warehouse_names},
)
Expand Down
4 changes: 2 additions & 2 deletions app/ui/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def decode_token(token: str):


def setup_permissions():
db = connection.execute("select current_database() as db").values[0][0]
db = connection.execute_select("select current_database() as db").values[0][0]

privileges = [
"EXECUTE MANAGED TASK",
Expand All @@ -64,7 +64,7 @@ def setup_permissions():
def setup_block():

db, account, user, sf_region, sd_deployment = list(
connection.execute(
connection.execute_select(
"""select current_database() as db,
current_account() as account,
current_user() as username,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme = "README.md"
python = "~3.8"
plotly = "~5.11"
streamlit = "~1.22"
snowflake-snowpark-python = { version = "^1.5.1", extras = ["pandas"] }
snowflake-snowpark-python = { version = "~1.5.1", extras = ["pandas"] }

[tool.poetry.group.dev.dependencies]
watchdog = "^3.0.0"