[sqlalchemy] join aliased

2014-03-22 Thread lars van gemerden
Hi all, Maybe (hopefully;-) i am missing something simple, but i have the following test code: engine = create_engine('sqlite:///:memory:', echo=True) Session = sessionmaker(bind=engine) Base = declarative_base() class User(Base):

Re: [sqlalchemy] join aliased

2014-03-22 Thread Michael Bayer
On Mar 22, 2014, at 9:16 AM, lars van gemerden l...@rational-it.com wrote: query = session.query(Email) query = query.join(user) #or query = query.join(user, aliased = True) query = query.add_columns(Email.email, User.name) the add_columns() method does not have the

[sqlalchemy] What's the typical use of the flag *active_history* for sqlalchemy.orm.column_property?

2014-03-22 Thread Bao Niu
In the documentation for sqlalchemy.orm.column_property, there is a section explaining the *active_history* flag. It is very terse. I think it is very useful but just cannot think of a scenario where I would ever want to use *previous* value when I'm setting a new value. Could someone use plain

Re: [sqlalchemy] What's the typical use of the flag *active_history* for sqlalchemy.orm.column_property?

2014-03-22 Thread Michael Bayer
when you're using an event such as before_flush() to check on attributes.get_history() so that you can see that a new version needs to be inserted into a version table, you need the old value of the attribute in order to compare. see the versioned_history example. On Mar 22, 2014, at 4:34

Re: [sqlalchemy] What's the typical use of the flag *active_history* for sqlalchemy.orm.column_property?

2014-03-22 Thread Bao Niu
Hi Michael, Just a quick line, version table is not something particularly useful for beginner users, am I right? Thanks. On Sat, Mar 22, 2014 at 2:52 PM, Michael Bayer mike...@zzzcomputing.comwrote: when you're using an event such as before_flush() to check on attributes.get_history() so

Re: [sqlalchemy] What's the typical use of the flag *active_history* for sqlalchemy.orm.column_property?

2014-03-22 Thread Michael Bayer
heh. reading the SQLA docs cover to cover is not particularly useful for beginners either... :) On Mar 22, 2014, at 6:12 PM, Bao Niu niuba...@gmail.com wrote: Hi Michael, Just a quick line, version table is not something particularly useful for beginner users, am I right? Thanks. On