the standard SQLAlchemy patterns should work fine here: - in 0.7, create_engine() will set up a NullPool when using SQLite against a file. SQLite doesn't really need connection pooling in the usual case. nothing special is required here on your part. - when using a Connection, if you're doing so explicitly, you use it in only one thread at a time. - when using the ORM, you use a Session as well as all the objects attached to that Session, in only one thread, without sharing across threads. Other threads use their own Session/objects. The scoped_session() registry is normally used to provide a "session per thread" pattern.
that's it ! On Oct 27, 2011, at 5:43 AM, Paul wrote: > I'm new to sqlalchemy and was looking at a good starting point. I currently > have > an application which has multiple threads at certain parts, some of which > need > access to the same sqlite database at the same time. Mostly only one writing > but > sometimes more than one thread will need to write to the database. So simply > using sqlite3 wont cut it. > > I was under the impression that this kind of setup can be achieved with > sqlalchemy but I was wondering which sort of setup with engine, pools and a > design pattern to best achieve this would be? > > Performance isn't a huge concern as small amounts of data will be being > written > at a time so blocking or queueing would be acceptable solutions. > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.