[sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Russ
What is the proper way to declare a postgresql partial index when using the @declared_attr decorator? This form gives me Cannot compile Column object until its 'name' is assigned: track_type = Column(SmallInteger, nullable = False) @declared_attr def __table_args__(cls):

Re: [sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Michael Bayer
Russ russandheat...@gmail.com wrote: I should have also indicated that the addition of sqlalchemy.sql.text fixes the small mixin example. The little script below works, but I don't know if it is a sketchy hack, or a safe long term solution: from sqlalchemy import * from sqlalchemy.orm

Re: [sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Russ
I should have also indicated that the addition of sqlalchemy.sql.text fixes the small mixin example. The little script below works, but I don't know if it is a sketchy hack, or a safe long term solution: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative

Re: [sqlalchemy] One to many lazy load generates incorrect query when the parent attribute appears more than once in the join expression

2015-02-02 Thread Michael Bayer
this is issue https://bitbucket.org/zzzeek/sqlalchemy/issue/3300/create_lazy_clause-is-only-turning-a which is fixed for master and 0.9.9. Please confirm git master and/or rel_0_9 tag works now, thanks! Michael Bayer mike...@zzzcomputing.com wrote: this is likely a bug. I’m looking into

Re: [sqlalchemy] column_property order_by error

2015-02-02 Thread Michael Bayer
the workaround, or using git master? Kevin S kevinrst...@gmail.com wrote: Yes, that does fix the issue. -- 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

Re: [sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Michael Bayer
Russ russandheat...@gmail.com wrote: What is the proper way to declare a postgresql partial index when using the @declared_attr decorator? these two concepts aren’t really connected This form gives me Cannot compile Column object until its 'name' is assigned: track_type =

Re: [sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Russ
What is the proper way to declare a postgresql partial index when using the @declared_attr decorator? these two concepts aren’t really connected Sorry -- I described that poorly, then. However, I only see the problem (in v0.9.8) when I am using @declared_attr as in the case of a

Re: [sqlalchemy] How to properly declare a postgresql partial index?

2015-02-02 Thread Russ
Thanks. The name addition seems tidier to me so I switched to that for the moment. On a somewhat unrelated note, I love the what's new in 1.0 docs you linked. I had not checked them out yet. The Performance section is particularly awesome and well written. Aspects of it bring me back to

[sqlalchemy] Duplicate entries in many-to-many relationship

2015-02-02 Thread David L.
Hi, I have a problem that is essentially identical to this: https://groups.google.com/forum/#!searchin/sqlalchemy/association$20table$20duplicate/sqlalchemy/2myGWqEg8LY/lCBB5q4F0PIJ However, I'm not sure how to proceed. I understand that I can simply check to see if a child exists before

[sqlalchemy] One to many lazy load generates incorrect query when the parent attribute appears more than once in the join expression

2015-02-02 Thread Jonathan Vanasco
This is a longshot, but does applying .label('another_name') on one of your columns work? -- 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

Re: [sqlalchemy] One to many lazy load generates incorrect query when the parent attribute appears more than once in the join expression

2015-02-02 Thread Demetrio Girardi
On Tuesday, February 3, 2015 at 1:50:25 AM UTC+1, Michael Bayer wrote: this is issue https://bitbucket.org/zzzeek/sqlalchemy/issue/3300/create_lazy_clause-is-only-turning-a which is fixed for master and 0.9.9. Please confirm git master and/or rel_0_9 tag works now, thanks! I can

[sqlalchemy] column_property order_by error

2015-02-02 Thread Kevin S
I apologize up front for not being able to provide a reproducible example of my problem. We have built a web app in sqlalchemy for read-only access of our production database. We are in the process of migrating from one database architecture (Sybase) to another (Postgres). The goal is to have

Re: [sqlalchemy] One to many lazy load generates incorrect query when the parent attribute appears more than once in the join expression

2015-02-02 Thread Michael Bayer
this is likely a bug. I’m looking into it. Might be fixed today. Demetrio Girardi demetrio.gira...@gmail.com wrote: I am trying to define a relationship that self-joins multiple columns on IS NOT DISTINCT FROM. Since the backend I use does not support it, I mimic it like this: -

Re: [sqlalchemy] column_property order_by error

2015-02-02 Thread Michael Bayer
Kevin S kevinrst...@gmail.com wrote: This particular summary is ordering model objects by a column_property. Because of how our schema is setup, we use these column_properties often to eager load a single column from a one-to-one relationship (or petal table). The error is that

Re: [sqlalchemy] Duplicate entries in many-to-many relationship

2015-02-02 Thread Michael Bayer
David L. david.ly...@tailify.com wrote: Hi, I have a problem that is essentially identical to this: https://groups.google.com/forum/#!searchin/sqlalchemy/association$20table$20duplicate/sqlalchemy/2myGWqEg8LY/lCBB5q4F0PIJ However, I'm not sure how to proceed. I understand that I can

Re: [sqlalchemy] column_property order_by error

2015-02-02 Thread Kevin S
Yes, that does fix the issue. -- 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+unsubscr...@googlegroups.com. To post to this group, send email to

Re: [sqlalchemy] Adding the same object to two distinctive session objects seems leaky?

2015-02-02 Thread Michael Bayer
Bao Niu niuba...@gmail.com wrote: I learned that you cannot add the same model object to different session objects(unless you use scoped_session of course). However some behaviour seems strange and I don't know what I did wrong. Here is what I did: from sqlalchemy import Column, String,