[sqlalchemy] Best practice for binding the engine

2014-03-09 Thread Bao Niu
From reading the documentation I learned that you can either bind an engine to a session: engine = create_engine('sqlite:///{}'.format(dbPath), echo=False) Session = sessionmaker(bind=engine) or to a declarative_base: engine = create_engine('sqlite:///{}'.format(dbPath), echo=False)

[sqlalchemy] databases and asynchronous programming

2014-03-09 Thread Chris Withers
Hi All, So, one of the projects I'm playing with at the moment is a big ball of asynchronous networking (tonnes of protocols, some tcp, some multicast) which I want to stick a webapi onto (normal requests + websocket) and probably do some database interaction with. So, aside from figuring

[sqlalchemy] Cascade Delete, session confusion

2014-03-09 Thread Dmitry Berman
Hi all, I just started using SQLA, and I am confused by some cascade delete behaviour I am seeing. Please see the code and tests below which show that the session is seeing table rows in one area and not in the other: CODE: print Product1Mod3 __tablename__ = 'products' id =

[sqlalchemy] Re: Cascade Delete, session confusion

2014-03-09 Thread Dmitry Berman
I also looked at this through SQLite database browser, and the database is correct, so is this a Python side error? -- 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] Re: databases and asynchronous programming

2014-03-09 Thread Jonathan Vanasco
I'm using twisted and looking to move raw SQL ( via twisted's `runInteraction` ) into my SqlAlchemy model. I've only played with it a bit. A few notes: Under Twisted you can't have threads spawned threads. Your computer will want to die. I did and crashed the server several times,

Re: [sqlalchemy] Cascade Delete, session confusion

2014-03-09 Thread Michael Bayer
On Mar 9, 2014, at 3:18 PM, Dmitry Berman dmikha...@gmail.com wrote: print \nQuery to check for changes with products and modules, shows that the modules and product are gone:\n print Product.query.all() print Module.query.all() print \nThe modules below belong to the deleted product,

[sqlalchemy] tracking history across a 'flush()'

2014-03-09 Thread Jonathan Vanasco
I have some lightweight revision tracking on some models. I generate a diff based on the history of the object (via inspector). a limitation I just realized, is that this history only dates back to the most recent flush() -- it doesn't date back to the initial load. are there any existing

Re: [sqlalchemy] Cascade Delete, session confusion

2014-03-09 Thread Dmitry Berman
This makes a lot of sense, I just didn't realize how it worked... *When I did the following:* print inspect(Product1Mod1).deleted print inspect(Product1Mod2).deleted print inspect(Product1Mod3).deleted *Instead of just:* print Product1Mod1 print Product1Mod2 print Product1Mod3 This

[sqlalchemy] [ANN] SQLTap - SQL profiling and introspection for SQLAlchemy applications

2014-03-09 Thread Alan Shreve
A few years ago, I built SQLTap, a simple library to hook into SQLAlchemy and pull out statistics and information on the queries you ran. This last couple days I've overhauled it an updated it to make it more useful! You basically just start the profiler and then it can dump out nice browsable

Re: [sqlalchemy] tracking history across a 'flush()'

2014-03-09 Thread Michael Bayer
On Mar 9, 2014, at 8:25 PM, Jonathan Vanasco jonat...@findmeon.com wrote: I have some lightweight revision tracking on some models. I generate a diff based on the history of the object (via inspector). a limitation I just realized, is that this history only dates back to the most recent

Re: [sqlalchemy] [ANN] SQLTap - SQL profiling and introspection for SQLAlchemy applications

2014-03-09 Thread Michael Bayer
hey that looks pretty nice, ill give it a shoutout. On Mar 9, 2014, at 9:21 PM, Alan Shreve a...@inconshreveable.com wrote: A few years ago, I built SQLTap, a simple library to hook into SQLAlchemy and pull out statistics and information on the queries you ran. This last couple days I've