Re: [sqlalchemy] Need for ImplicitForeignKeyConstraint

2011-08-06 Thread Fayaz Yusuf Khan
So IFKC(ImplicitForeignKeyConstraint) should not have inherited FKC? I did it so that it could seamlessly be passed into Table() and __table_args__. PS: Everyone, the repo is at https://bitbucket.org/fayaz/implicit On Friday, August 05, 2011 07:31:44 PM Michael Bayer wrote: yeah wow I just saw

Re: [sqlalchemy] Re: Cascade Deletes

2011-08-06 Thread Stefano Fontanelli
Il 06/08/11 00.32, Aviv Giladi ha scritto: Hi Stefano, I create and add a Rating and Subrating (both end up in the DB no problem). Then, I call session.delete(rating_obj) and commit it. I look at the DB, and the Rating is gone, but the SubRating is still there. The DB shows that the Rating has

Re: [sqlalchemy] Declarative Field Type 'Alias'

2011-08-06 Thread Wichert Akkerman
On 08/05/2011 10:46 PM, Mark Erbaugh wrote: This is more of a Python issue than a SA issue, but I had trouble getting this to work. I did, but the code seems a little awkard to mesigh. In addition to the requirements already, I also wanted toe default value to be a class level 'constant'.

Re: [sqlalchemy] Default values

2011-08-06 Thread Mike Conley
You can get to the column default value. class MyTable(Base): __tablename__ = 'table' id = Column(Integer, primary_key=True) name = Column(String, default='new name') def __init__(self, name=None): if name is not None: self.name =

Re: [sqlalchemy] Default values

2011-08-06 Thread Mark Erbaugh
On Aug 6, 2011, at 7:18 AM, Mike Conley wrote: You can get to the column default value. class MyTable(Base): __tablename__ = 'table' id = Column(Integer, primary_key=True) name = Column(String, default='new name') def __init__(self, name=None):

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Arturo Sevilla
As a follow up to this thread, I've seen in the code in version 0.7.2 that comparator_factory is no longer working for CompositeProperty. Is this a bug? Reference: http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/orm/descriptor_props.py#L75 You can see that in the constructor there is no

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Michael Bayer
I cannot locate the rationale for this despite a dim memory that there was one, so this is a bug with ticket 2248 created at http://www.sqlalchemy.org/trac/ticket/2248 , with a restorative patch attached. If someone can provide tests for the attached patch using a custom comparator and

[sqlalchemy] Re: Cascade Deletes

2011-08-06 Thread Aviv Giladi
Stefano, Thanks! Your script helped me narrow down the problem. My Rating object has multiple Subrating objects. So in my real code, I have something like: class SubRating1(Base): __tablename__ = 'subratings1' id = Column(Integer, primary_key=True) name = Column(Unicode(32),

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Arturo Sevilla
I will see if later today I can provide some tests, or by tomorrow. I think the basic rationale is that a composite property should behave like a regular mapped property, and those have a comparator_factory, although I know this is probable a lame argument. -- You received this message

Re: [sqlalchemy] Does orm.synonym's comparator_factory work?

2011-08-06 Thread Michael Bayer
oh...sorry I meant the rationale for it being removed in 0.7, it had something to do with the internals of the whole thing. Perhaps I just forgot to re-implement, not sure. On Aug 6, 2011, at 7:24 PM, Arturo Sevilla wrote: I will see if later today I can provide some tests, or by tomorrow.