Ralf Kowatsch
06/01/2026, 7:44 PMDeepyaman Datta
06/01/2026, 7:51 PMibis.TableDataset now supports upserts, including on Snowflake, if that may help. 🙂
Re your question, Spark is the closest analog here, and Spark handles sessions creation through a hook.Ralf Kowatsch
06/01/2026, 7:57 PMGustavo Mendonça Ferratti
06/02/2026, 10:47 AMbefore_pipeline_run hooks exist precisely for this kind of shared resource management. I'd initialize the Snowpark session once there, inject it via credentials or a shared config mechanism, and close it cleanly at the end.
The singleton in the Dataset does have the advantage of being faster to get running. But if you're building a standard for a team, the hook will hold up much better in the long term; especially if you ever run nodes in parallel or need to reuse the Dataset outside a pipeline context.
Happy to dig into specifics if you're running into constraints that make the hook harder to wire up!
Best,
GustavoRalf Kowatsch
06/15/2026, 12:56 PMGustavo Mendonça Ferratti
06/15/2026, 1:12 PMbefore_dataset_loaded and after_dataset_saved to borrow and release sessions from a pool. Those hooks don't give you the dataset instance directly, so you'd have to inject the session at runtime, either by patching catalog._datasets[dataset_name] or by wrapping your datasets in a class that accepts a session at load/save time.
For the pool, queue.Queue is the natural fit for me. Create your sessions at before_pipeline_run, push them into the queue, then get() before load/save and put() right after.
One thing worth knowing beforehand is taht Snowpark Python now supports thread-safe session objects, so multiple threads can share the same session. That said, thread safety is controlled by the PYTHON_SNOWPARK_ENABLE_THREAD_SAFE_SESSION parameter, and the key protected operations include configuration changes, package and import management, and plan caching. So if your nodes touch any of that, a pool still makes more sense than a single shared session.
Also, the runner choice matters a lot, since ParallelRunner uses multiprocessing while ThreadRunner uses multithreading. For your case, ParallelRunner is probably a no-go because all datasets need to be serialisable for multiprocessing to work, and any dataset that isn't will block the whole run. A Snowpark session almost certainly won't survive pickling. So ThreadRunner is the realistic path here, and it actually plays nicer with the session pool approach you're describing.