Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-09-16 Thread Jakub Bąk
Thanks a lot! It works but I still have a problem. I want to make one query to get the root directory, all its children and the filenames of Image objects. My directory model looks like this: class Directory(Node): is_root = db.Column(db.Boolean, default=False) children =

Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-09-16 Thread Mike Bayer
On 9/16/15 5:28 AM, Jakub Bąk wrote: Thanks a lot! It works but I still have a problem. I want to make one query to get the root directory, all its children and the filenames of Image objects. My directory model looks like this: | classDirectory(Node): is_root

Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-09-15 Thread Mike Bayer
On 9/15/15 10:09 AM, Jakub Bąk wrote: I used before_delete and after_commit and it works like a charm. Thanks again! I have another problem related to this setup. I have a property defined on the Image model: | @property deffilename(self):

Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-09-15 Thread Jakub Bąk
I used before_delete and after_commit and it works like a charm. Thanks again! I have another problem related to this setup. I have a property defined on the Image model: @property def filename(self): return '{basename}.{extension}'.format(basename=self.basename, extension =self.extension)

Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-08-27 Thread Jakub Bąk
Those are some great ideas. I will try them out. Thanks Michael! W dniu wtorek, 25 sierpnia 2015 17:16:16 UTC+2 użytkownik Michael Bayer napisał: On 8/25/15 10:05 AM, Jakub Bąk wrote: I just came across a solution to this problem. Adding 'with_polymorphic': '*' to __mapper_args__ on the

Re: [sqlalchemy] Re: polymorphic identity after_delete event

2015-08-25 Thread Mike Bayer
On 8/25/15 10:05 AM, Jakub Bąk wrote: I just came across a solution to this problem. Adding 'with_polymorphic': '*' to __mapper_args__ on the Node model was enough. | classNode(db.Model): id =db.Column(db.Integer,primary_key=True) type =db.Column(db.String(20)) name

[sqlalchemy] Re: polymorphic identity after_delete event

2015-08-25 Thread Jakub Bąk
I just came across a solution to this problem. Adding 'with_polymorphic': '*' to __mapper_args__ on the Node model was enough. class Node(db.Model): id = db.Column(db.Integer, primary_key=True) type = db.Column(db.String(20)) name = db.Column(db.String(30), nullable=False) date_added