[sqlalchemy] Re: get_history of composite properties in SqlAlchemy 0.7.3

2011-12-08 Thread Laurence De Jong
Thank you for the fast reply and the fix! I case somebody encounters this problem and doesn't want from a checkout, workarounds are: In the init of the Example class, access the point or set to None: class Example(Base): __tablename__ = 'example' id = Column(Integer, primary_key=True)

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-08 Thread Michael Bayer
On Dec 7, 2011, at 11:08 PM, kris wrote: Hmm, I think I want the opposite behavior. I was the defualt mapper to Resource unless a more specific mapper has been defined. I never defined a 'C' or 'D' and I would like simple get a Resource when no better mapper is found. i.e. I get

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-08 Thread Michael Bayer
the recipe is broken, please wait until i have time to fix it, thanks. On Dec 8, 2011, at 11:27 AM, Michael Bayer wrote: On Dec 7, 2011, at 11:08 PM, kris wrote: Hmm, I think I want the opposite behavior. I was the defualt mapper to Resource unless a more specific mapper has been

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-08 Thread Michael Bayer
OK it works (not yet in tip though). On Dec 8, 2011, at 11:43 AM, Michael Bayer wrote: the recipe is broken, please wait until i have time to fix it, thanks. On Dec 8, 2011, at 11:27 AM, Michael Bayer wrote: On Dec 7, 2011, at 11:08 PM, kris wrote: Hmm, I think I want the opposite

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-08 Thread kris
Does this mean I can use this in 7.3? or Do I need to download tip? Also could you show me how this would work with old style mapper(...) s instead of declarative_base? Thanks, Kris -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this

[sqlalchemy] Meetup group in Vancouver BC

2011-12-08 Thread Iain Duncan
Hey all, I just created a meetup group in Vancouver BC for Pyramid and Pylons users. I'm wondering if I should really make it Pyramid/Pylons/SQLAlchemy. At any rate, SA certainly seems to be the most popular persistence mechanism for Pyramid. If you're in Van, I'd love to hear from you.

Re: [sqlalchemy] Single Table Inheritance, multiple mappers and default (base) mapper

2011-12-08 Thread Michael Bayer
works in 0.7.3. will also work in 0.7.4 Just not the current tip at the moment. the regular mapper() setup is equivalent (see http://www.sqlalchemy.org/docs/orm/mapper_config.html#classical-mappings) : discriminator_expr = case(...) mapper(Person, ..., polymorphic_on=discriminator_expr,

[sqlalchemy] cherrypy SA 0.7 scoped_session

2011-12-08 Thread John Hufnagle
I've been beating my head over this one. I read the ORM Creating a Thread-local Context doc and the web but don't see a simple answer...saw some old SA/Cherrypy code that used cherrypy 'tools' etc. The SA doc seems straightforward but I keep getting sqlalchemy.exc.UnboundExecutionError errors.

Re: [sqlalchemy] cherrypy SA 0.7 scoped_session

2011-12-08 Thread Michael Bayer
On Dec 8, 2011, at 4:26 PM, John Hufnagle wrote: I've been beating my head over this one. I read the ORM Creating a Thread-local Context doc and the web but don't see a simple answer...saw some old SA/Cherrypy code that used cherrypy 'tools' etc. The SA doc seems straightforward but I keep

Re: [sqlalchemy] Dirty columns?

2011-12-08 Thread Michael Bayer
On Dec 8, 2011, at 4:55 PM, Michael Hipp wrote: I'm getting a dirty indication on a particular ORM object from session.is_modified(rec, passive=True) and also that same rec shows up in session.dirty. But I can't figure out where/how it's been modified. Is there some way to determine up

Re: [sqlalchemy] SQLA 0.6.8 Given an AssociationProxy, how can I get the class it would give me?

2011-12-08 Thread Hector Blanco
Just a little detail... To get the class of a regular relationship, I use a class_mapper: def getClassOfRelationship(cls, name): retval = None mapper = sqlalchemy.orm.class_mapper(cls) try: prop = mapper.get_property(name) if

[sqlalchemy] Re: cherrypy SA 0.7 scoped_session

2011-12-08 Thread John Hufnagle
Thanks Michael, Could not find a hidden Session object. So I broke it down into a problem that works/doesn't work based on files separation 1. If I place all of the code into one file all_in_one.py which contains the cherrypy startup, the SA init code and ORM object and the cherrypy REST

Re: [sqlalchemy] Dirty columns?

2011-12-08 Thread Michael Hipp
On 2011-12-08 4:11 PM, Michael Bayer wrote: On Dec 8, 2011, at 4:55 PM, Michael Hipp wrote: I'm getting a dirty indication on a particular ORM object from session.is_modified(rec, passive=True) and also that same rec shows up in session.dirty. But I can't figure out where/how it's been

[sqlalchemy] Is it possible to have a transaction commit to the db and then rollback? (SA 0.7, Python 2.7, Postgres)

2011-12-08 Thread Noon Silk
I can't figure out how. I have the following setup: ... engine = create_engine(...) session = scoped_session(sessionmaker(..., bind=engine)) ... session.add(object) session.commit() What I need is to add this object *to the database*, and then select it in some non-sql-alchemy code, and then

Re: [sqlalchemy] Is it possible to have a transaction commit to the db and then rollback? (SA 0.7, Python 2.7, Postgres)

2011-12-08 Thread Noon Silk
Please disregard this; I've solved it. On Fri, Dec 9, 2011 at 11:18 AM, Noon Silk noonsli...@gmail.com wrote: I can't figure out how. I have the following setup: ... engine = create_engine(...) session = scoped_session(sessionmaker(..., bind=engine)) ... session.add(object)

Re: [sqlalchemy] Re: cherrypy SA 0.7 scoped_session

2011-12-08 Thread Diana Clarke
Hi John: The following import is causing that error.     from sqlalchemy.orm import session, Session In the all-in-one example you provided, you later go on to reassign 'session' and 'Session', replacing those imported values with your own values.     Session =

Re: [sqlalchemy] Re: cherrypy SA 0.7 scoped_session

2011-12-08 Thread Diana Clarke
[hmmm, let's try that again... not sure why gmail mangled my email] Hi John: The following import is causing that error. from sqlalchemy.orm import session, Session In the all-in-one example you provided, you later go on to reassign 'session' and 'Session', replacing those imported values

[sqlalchemy] Re: cherrypy SA 0.7 scoped_session

2011-12-08 Thread John Hufnagle
Thanks! That was it. My weak Python understanding was my downfall! On Dec 8, 11:06 pm, Diana Clarke diana.joan.cla...@gmail.com wrote: [hmmm, let's try that again... not sure why gmail mangled my email] Hi John: The following import is causing that error.     from sqlalchemy.orm import