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

   Hello, thank you so much for the great work with this project! I wanted to 
highlight an issue I've encountered when working with SQLite data from the 
Arrow-ADBC Python API. Please don't hesitate to let me know if I may clarify 
any of the below. Thanks for any help or guidance you can provide on this!
   
   My usecase involves wanting to modify the 
[journal_mode](https://www.sqlite.org/pragma.html#pragma_journal_mode) of an 
existing SQLite database from `DELETE` to `WAL` through a Python ADBC 
connection. When I try this I see an error:
   
   `adbc_driver_manager._lib.OperationalError: ADBC_STATUS_IO (10): [SQLite] 
AdbcStatementRelease: statement failed to finalize: (1) cannot change into wal 
mode from within a transaction`
   
   Example code which demonstrates this may be found here:
   ```python
   import adbc_driver_sqlite.dbapi
   
   # note: assume here that the database is set to
   # default journal_mode of DELETE
   database_path = "path_to_a_sqlite_file"
   
   conn = adbc_driver_sqlite.dbapi.connect(database_path)
   cursor = conn.cursor()
   # attempt to change the journal_mode to WAL
   cursor.execute("PRAGMA journal_mode=WAL;")
   cursor.close()
   conn.close()
   ```
   
   One workaround is to supply an explicit commit before attempting to change 
the SQLite PRAGMA (see below).
   
   ```python
   import adbc_driver_sqlite.dbapi
   
   # note: assume here that the database is set to
   # default journal_mode of DELETE
   database_path = "path_to_a_sqlite_file"
   
   conn = adbc_driver_sqlite.dbapi.connect(database_path)
   cursor = conn.cursor()
   # run explicit commit prior to pragma change
   cursor.execute("COMMIT;")
   # attempt to change the journal_mode to WAL
   cursor.execute("PRAGMA journal_mode=WAL;")
   cursor.close()
   conn.close()
   ```
   
   
   
   


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