Hello! Do the database connector blocks (Snowflake...
# ask-community
a
Hello! Do the database connector blocks (Snowflake connector in particular) reuse the same connection for all flows or do they create one per flow? I’d like to my subflows in parallel, but since they use transactions, I’d need a new connection for every subflow.
d
https://github.com/PrefectHQ/prefect-snowflake/blob/e16b55b6a181b1e7847bbbf25a8f82011a9beb36/prefect_snowflake/database.py#L148 Based on the source code, yes the connection is reused. The way around this is to create a new instance of the block for each flow.
SnowflakeConnector.load("my-block")
should be run inside of each subflow that needs its own connection.
a
Thanks @Dominic Tarro!