Re: [sqlalchemy] Domain models and "leaky abstractions"

2015-11-16 Thread Yegor Roganov
Hi David, thanks for your reply. Do not use mapped entities at all for read-only tasks, and instead load > specific columns and use class methods on the models to encapsulate > knowledge. That makes for simple code since there is no need to introduce > an explicit view abstraction layer, but

[sqlalchemy] Best way to use SERIALIZABLE READ ONLY DEFERRABLE transaction with the ORM?

2015-11-16 Thread Donald Stufft
I am currently using the SQLAlchemy ORM and I'd like to be able to start up transactions using PostgreSQL's SERIALIZABLE READ ONLY DEFERRABLE isolation level. I don't want every single transaction to use this isolation level nor do I have the ability to change the server configuration so I need

Re: [sqlalchemy] Domain models and "leaky abstractions"

2015-11-16 Thread David Allouche
> On 13 Nov 2015, at 09:16, Yegor Roganov wrote: > > Suppose we have a 1 <-> N relation between users and cities (meaning that > every user is related with one city). For our domain model "User" we want to > define a method "lives_in_london". Code looks like this: > >

Re: [sqlalchemy] How do a I create Postgres Materialized View using SQLAlchemy?

2015-11-16 Thread Mike Bayer
On 11/16/2015 02:23 AM, Jeff Widman wrote: > Thanks Mike. That helped tremendously. > > A couple of followup questions: > (questions based on this code extending the view recipe: > https://gist.github.com/jeffwidman/1656498de21dc0afcdab) > > 1) In the recipe for creating views, I see: > >