[sqlalchemy] Re: Re: Possible bug with views

2015-05-06 Thread Brecht Machiels
Hello Mike, On Tue, 05 May 2015 21:09:31 +0200, Mike Bayer mike...@zzzcomputing.com wrote: On 5/5/15 1:17 PM, Brecht Machiels wrote: Oops, was a bit too quick there... Here's the echo='debug' output: 2015-05-05 19:16:11,528 INFO sqlalchemy.engine.base.Engine SELECT * FROM group_counts

Re: [sqlalchemy] Why is an association object mark as dirty instead of deleted when removed?

2015-05-06 Thread steve
Hmm, I don't think I could listen to the attribute event; it's saying that the AssociationProxy doesn't have dispatch. Also, suppose I could detect the orphan-deletes earlier, what's the best way to suppress the objects marked as dirty? Here's my version of your code if it helps:

Re: [sqlalchemy] Default column value before an object is commited

2015-05-06 Thread Mike Bayer
On 5/6/15 9:43 PM, Anton wrote: I decided to use to an event based solution, but I did not want to duplicate default values in the listener function, so I trying to do it in the following way: | @event.listens_for(MyModel,'init') definit(target,args,kwargs): target_type =type(target)

[sqlalchemy] Default column value before an object is commited

2015-05-06 Thread Anton
*The goal* I have an ORM model. class MyModel(Model): __tablename__ = 'my_model' col1 = db.Column(db.Boolean, default=False, server_default=false()) col2 = db.Column(db.Integer, default=100, server_default=null()) I want to be able to create an object and have col1 and col2 be

Re: [sqlalchemy] Why is an association object mark as dirty instead of deleted when removed?

2015-05-06 Thread Mike Bayer
On 5/6/15 9:56 AM, st...@canary.md wrote: Hmm, I don't think I could listen to the attribute event; it's saying that the AssociationProxy doesn't have dispatch. oh. well yes, the event has to be on the mapped attributes that the association proxy is proxying. the associationproxy is just