[sqlalchemy] inheritance + overriding

2011-10-24 Thread mnagni
Hello, I have two tables which looks like class CI_OnlineResource(object): def __init__(self): super(CI_OnlineResource, self).__init__() self.applicationProfile = None self.function = None class MO_OnlineResource(CI_OnlineResource):

[sqlalchemy] is None converted to null using engine.execute?

2011-10-24 Thread Krishnakant Mane
Hello all. I have come across an interesting problem with sqlalchemy. I am using 0.6.8 and plan to shift obviously to the .7 series. But what ever the version is, I find this is really very interesting. I have to execute stored procedures written in plpgsql (for postgresql 9.0). The problem

[sqlalchemy] Re: inheritance + overriding

2011-10-24 Thread mnagni
a small errata... [...] because in my specifications is required that 1) CI_OnlineResource.applicationProfile is a String 2) MO_OnlineResource.applicationProfile is an ENUM of String type [...] sorry! On Oct 24, 4:43 pm, mnagni m.na...@gmail.com wrote: Hello, I have two tables which looks

Re: [sqlalchemy] is None converted to null using engine.execute?

2011-10-24 Thread Michael Bayer
On Oct 23, 2011, at 2:11 PM, Krishnakant Mane wrote: I wish to know if None in Python really gets converted to null in postgresql? it is converted to NULL by psycopg2 if passed as a bound parameter to cursor.execute(). To understand what this means at a DBAPI level please read

Re: [sqlalchemy] inheritance + overriding

2011-10-24 Thread Michael Bayer
On Oct 24, 2011, at 11:43 AM, mnagni wrote: class CI_OnlineResource(object): def __init__(self): super(CI_OnlineResource, self).__init__() self.applicationProfile = None self.function = None class MO_OnlineResource(CI_OnlineResource):

Re: [sqlalchemy] inheritance + overriding

2011-10-24 Thread Maurizio Nagni
Thanks for the quick and detailed reply but I guess that I should add a further information to the discussion. Probably I tried to simplify too much the problem... The mapping that I have is generated automatically from a multiple number of UML models. I knew the doc you mention

[sqlalchemy] Re: inheritance + overriding

2011-10-24 Thread mnagni
Wonderfull! I still have to test any insert/query but for now the tables seems to be generated correctly! Thanks!! On Oct 24, 8:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 24, 2011, at 2:56 PM, Maurizio Nagni wrote: sqlalchemy.exc.InvalidRequestError: Implicitly combining

[sqlalchemy] Ensure that relationships aren't loaded in query

2011-10-24 Thread Devraj Mukherjee
Hi all, I have a model that loads a many relationship (User has many addresses) class User(Base): __table__ = Base.metadata.tables['user'] addresses = relationship(Address, backref=user) For one of our queries I want to ensure that the relationship is not fetched. Is this possible?

Re: [sqlalchemy] Ensure that relationships aren't loaded in query

2011-10-24 Thread Michael Bayer
the relationship will not be fetched if it is never accessed. If you'd like to call append()/remove() on it, but not have it load when this occurs, lazy=dynamic will do that. To disable loading under all circumstances including iteration, lazy=noload. On Oct 24, 2011, at 6:10 PM, Devraj

Re: [sqlalchemy] storing mutable python list into SQL db

2011-10-24 Thread Michael Bayer
you'd start with building yourself a list that can invoke self.changed(). Basically subclassing list and overridding append(), __setitem__() plus more methods at http://docs.python.org/reference/datamodel.html#emulating-container-types . Also perhaps look at