deliverr / data-knex-snowflake-dialect

knex.js dialect for the Snowflake data warehouse
MIT License
13 stars 26 forks source link

Connection validation / disposal is not working #70

Open GabrielLomba opened 4 months ago

GabrielLomba commented 4 months ago

Hi! This dialect relies on SF connection error event emissions. However, the default SF SDK Connection class does not emit them (I created an issue on their repo as well related to this confusing behavior). This means bad connections will still be kept in the pool since the validateConnection implementation is rather simple.

A better validateConnection implementation could make use of the isValidAsync SDK method which will verify if the connection is up and do a heartbeat to ensure it's ready to receive queries. I'm willing to submit a PR to fix it.