Class Session
Mirrors the subset of the real Snowpark Session surface that handler code uses, and reproduces
Snowflake's stored-procedure restrictions, all rejected at runtime: creating a new session, obtaining the
underlying JDBC connection, running two queries at the same time (concurrency — see
beginQuery() for why that is not the thread check the documentation's wording suggests), and
creating named temporary objects under owner's rights. Matches the documented Java stored-procedure
limitations
(https://docs.snowflake.com/en/developer-guide/stored-procedure/java/procedure-java-limitations).
Deliberately does not expose the underlying DatabaseEngine; the real Snowpark
Session has no such accessor, and exposing it would let handler code escape the session sandbox.
-
Constructor Summary
ConstructorsConstructorDescriptionSession(DatabaseEngine engine) Session(DatabaseEngine engine, boolean ownersRights) -
Method Summary
Modifier and TypeMethodDescriptionstatic SessionBuilderbuilder()Entry point for theSession.builder()...create()idiom.Snowflake does not allow a stored procedure to access the session's underlying JDBC connection.Build a plan oversqlText.
-
Constructor Details
-
Session
-
Session
- Parameters:
ownersRights- true when the procedure runs with the owner's rights (EXECUTE AS OWNER, the default), which forbids creating named temporary objects.
-
-
Method Details
-
sql
Build a plan oversqlText. Nothing is submitted here — seeDataFrame.The refusals that used to live in this method moved to
runPlan(java.lang.String), because that is where live raises them: a handler that callssession.sql("CREATE TEMPORARY TABLE …")under owner's rights and never collects returns normally on Snowflake, and only the added.collect()produces "Unsupported statement type 'temporary TABLE'". -
table
-
builder
Entry point for theSession.builder()...create()idiom. Building configuration is permitted; the terminalSessionBuilder.create()call is rejected, because Snowflake prohibits creating a new session from within a stored procedure. -
jdbcConnection
Snowflake does not allow a stored procedure to access the session's underlying JDBC connection.- Throws:
UnsupportedOperationException- always
-