--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.---You received this message because you are subscribed to the Google Groups "sqlalchemy" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/bd49f8f6-d930-4726-8c59-6eea6ed06825n%40googlegroups.com.
hey there-engine.begin() does not do anything to the SQLite connection at all as there is no begin() method in the Python DBAPI. this is why in your logging you will see a line that says "BEGIN (implicit)". nothing happened. the pysqlite driver controls the scope of the actual BEGIN on the sqlite3 library implcitly and there should be no difference at all in 2.0 vs. 1.x in how this occurs. There is also no difference between calling engine.begin() or connection.begin(), assuming "connection" here is the SQLAlchemy connection- engine.begin() simply calls connection.begin() after procuring the connection.
note that pysqlite's implicit control of transactions is often insufficient for some scenarios where fine-grained control of transactions scope is desired, which is where the recipe at https://docs.sqlalchemy.org/en/13/dialects/sqlite.html#serializable-isolation-savepoints-transactional-ddl comes from in order to circumvent pysqlite's assumptions.
if you can please provide specifics that illustrate the difference in behavior as well as how you detect the WAL condition (as I am unfamiliar with this aspect of sqlite) that would be appreciated.
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.---You received this message because you are subscribed to the Google Groups "sqlalchemy" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CA%2BXzfkqB_qr3Lgthda3ySkog9RgdbE8eB5z2Lhx3BcLxmLjiXw%40mail.gmail.com.Attachments:
- benchmark_sqlite_transactions.py
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/985daffb-abcf-43cb-bd74-47bfba9f0d97%40www.fastmail.com.
Can I ask what documentation led you to believe that engine.connect() was somehow being removed ?
yeah in fact that engine.begin() here is using a brand new SQLite connection each time as the default pool for SQlite files is NullPool, as it is a very fast connecting database and it is the safest option for concurrency. So in your first example, you have a brand new file connection and all of your WAL setup code is running each tme. In the second example, it runs only once.background on pooling:if you use the SingletonThreadPool instead of the default NullPool, you will again get the same performance with engine.begin(). however, there is no need to change existing code that uses engine.connect() / connection.begin().
Thanks,--Jonathan Brandmeyer
--SQLAlchemy -The Python SQL Toolkit and Object Relational MapperTo post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.---You received this message because you are subscribed to the Google Groups "sqlalchemy" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CA%2BXzfkpqV2PDBm9EQYBZT6jiO_ZKHR1uKn%2BwB90t2D23An10ug%40mail.gmail.com.