Niivii opened a new issue, #3730:
URL: https://github.com/apache/arrow-adbc/issues/3730

   ### What happened?
   
   Connection is sometimes hanging or not closing properly while querying data 
from Snowflake via Polars.
   Everything is successful on Snowflake side.
   
   On ADBC 1.7.0, Go driver 1.14.1 and Polars 1.32.3 this would trigger our 
timeout function wrappers but with 
   ADBC 1.9.0,Go driver 1.17.0 and Polars 1.35.2 this is just left hanging.
   
   ### Stack Trace
   
   File "/home/appuser/app/main.py", line 94, in job
       sql_connection.create_snowflake_connection(
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
           job_settings.db_snowflake) as snowflake_connection,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/.venv/lib/python3.13/site-packages/adbc_driver_manager/dbapi.py", 
line 249, in __exit__
       self.close()
       ~~~~~~~~~~^^
     File "/.venv/lib/python3.13/site-packages/adbc_driver_manager/dbapi.py", 
line 351, in close
       self._conn.close()
       ~~~~~~~~~~~~~~~~^^
     File "adbc_driver_manager/_lib.pyx", line 1138, in 
adbc_driver_manager._lib.AdbcConnection.close
     File "adbc_driver_manager/_lib.pyx", line 334, in 
adbc_driver_manager._lib._AdbcHandle._check_open_children
     File "adbc_driver_manager/_lib.pyx", line 336, in 
adbc_driver_manager._lib._AdbcHandle._check_open_children
   RuntimeError: Cannot close AdbcConnection with open AdbcStatement
   
   ### How can we reproduce the bug?
   
   ```python   
   with (
       sql_connection.create_snowflake_connection(
           job_settings.db_snowflake) as snowflake_connection,
   ):
       try:
           snowflake_df = db.get_snowflake_current_data(
               snowflake_connection=snowflake_connection,
           )
       # ...
   
   def get_snowflake_current_data(
           snowflake_connection: adbc_driver_snowflake.dbapi.Connection,
   ) -> pl.DataFrame:
       with Path.open(Path("./query_snowflake.sql")) as query_snowflake:
           stmt_snowflake = query_snowflake.read()
       snowflake_df = pl.read_database(query=stmt_snowflake, 
connection=snowflake_connection)
   
       return snowflake_df
   ```
   
   ### Environment/Setup
   
   latest versions of adbc, polars, pyarrow, etc.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to