from monday_com_orca_backend import config from monday_com_orca_backend.connectors import snowflake_db # Keep a global instance of the Snowflake client to avoid # re-initializing it for every request. _snowflake_client: snowflake_db.Client | None = None def get_snowflake_client(): """Lazy initialization of the Snowflake client, for efficiency reasons and to prevent issues with unit tests, when not providing valid credentials. """ global _snowflake_client if _snowflake_client is None: _snowflake_client = snowflake_db.Client(**config.SNOWFLAKE_CREDENTIALS) return _snowflake_client