Skip to content

Commit

Permalink
depr(snowflake): deprecate from_snowpark method (#9680)
Browse files Browse the repository at this point in the history
Co-authored-by: Phillip Cloud <[email protected]>
  • Loading branch information
deepyaman and cpcloud authored Jul 25, 2024
1 parent ac3e233 commit 7254f65
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/posts/run-on-snowflake/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ figure out, and these are the questions we will answer throughout the post.

## Getting the Ibis connection

The release of Ibis 9.0 includes the introduction of a new method,
[`from_snowpark`](../../backends/snowflake.qmd#ibis.backends.snowflake.Backend.from_snowpark)
The release of Ibis 9.2 includes the introduction of a new method,
[`from_connection`](../../backends/snowflake.qmd#ibis.backends.snowflake.Backend.from_connection)
to provide users with a convenient mechanism to take an existing Snowpark
session and create an Ibis Snowflake backend instance with it.

Expand All @@ -50,7 +50,7 @@ import ibis
import snowflake.snowpark as sp

session = sp.Session.builder.create()
con = ibis.snowflake.from_snowpark(session)
con = ibis.snowflake.from_connection(session)
```

This connection uses the same session within Snowflake, so temporary objects
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/snowflake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _setup_session(self, *, session_parameters, create_object_udfs: bool):
f"Unable to create Ibis UDFs, some functionality will not work: {e}"
)

@util.experimental
@util.deprecated(as_of="10.0", instead="use from_connection instead")
@classmethod
def from_snowpark(
cls, session: snowflake.snowpark.Session, *, create_object_udfs: bool = True
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/snowflake/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def connect(*, tmpdir, worker_id, **kw) -> BaseBackend:
"schema": os.environ["SNOWFLAKE_SCHEMA"],
}
)
return ibis.backends.snowflake.Backend.from_snowpark(builder.create())
return ibis.backends.snowflake.Backend.from_connection(builder.create())
else:
return ibis.connect(_get_url(), **kw)

Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/snowflake/tests/test_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def test_ibis_inside_snowpark(snowpark_session, execute_as):
def ibis_sproc(session):
import ibis.backends.snowflake

con = ibis.backends.snowflake.Backend.from_snowpark(session)
con = ibis.backends.snowflake.Backend.from_connection(session)

expr = (
con.tables.functional_alltypes.group_by("string_col")
Expand Down
4 changes: 3 additions & 1 deletion ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ def test_create_table_from_schema(con, new_schema, temp_table):
)
def test_create_temporary_table_from_schema(con_no_data, new_schema):
if con_no_data.name == "snowflake" and os.environ.get("SNOWFLAKE_SNOWPARK"):
with pytest.raises(com.IbisError, match="Reconnecting is not supported"):
with pytest.raises(
com.IbisError, match="Cannot reconnect to unconfigured .+ backend"
):
con_no_data.reconnect()
return

Expand Down

0 comments on commit 7254f65

Please sign in to comment.