gaspardc-met opened a new issue, #1869:
URL: https://github.com/apache/arrow-adbc/issues/1869

   ### What would you like help with?
   
   Hello,
   
   I have recently started using `adbc_driver_postgresql` and 
`adbc-driver-manager` along with pandas `read_sql` to query data from a 
Postgres database.
   With SQLalchemy, everyone mentions the Connection Pool that should help with 
my case, but no trace of a Connection Pool in the ADBC docs. 
   Why my python webapp starts, several different database requests are made, 
most to the same table. 
   
   I do not know what are the best practices or the most efficient way to 
handle ADBC connections. 
   - Should I use a context manager for the connection to close is afterwards ?
   This is the recommended use in the Pandas documentation (above 2.2.0) 
   However, the `dbapi.connect` is long, laways longer than the actual 
`read_sql` (see attached image for a profiling example), and is executed 
everytime.
   
![image](https://github.com/apache/arrow-adbc/assets/78359781/57ef0055-0827-4051-a4ea-16a63942f694)
   
   ```python
   from adbc_driver_postgresql import dbapi
   
   with dbapi.connect(uri) as adbc_conn:
       return read_sql(query,adbc_conn)
   ```
   
   - Should I just leave the connection open ? 
   - Should I cache the connection resource ? 
   
   I'm sure that like any engineering problems there are tradeoffs to all of 
these, but I do not have comparison points here apart from execution time
   
   thanks ! 
   
   Environment:
   - python 3.11
   - pandas == 2.2.2
   - adbc_driver_postgresql==0.11.0
   - adbc-driver-manager==0.11.0
   


-- 
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