Shorthand for multiple column comparisons

Issue #13 resolved
Ben Ben created an issue

When testing for multiple column equivilants, specifying the full class for each column becomes a chore, take this example:

# load a User from the database            
sqlmyuser = User.mapper.select(User.c.user_name=='fred', User.c.password=='something',
                                                   User.c.email=='someone@somewhere.com')

If we use a slightly different keyword (inspired by SQLObject notation) like so:

# load a User from the database            
sqlmyuser = User.mapper.select_by(user_name='fred', password='something', email='someone@somewhere.com')

We save ourselves a bit of repetitive typing. I come across usage like this fairly often so I think it'd be rather useful in SQLAlchemy as well.

Comments (3)

  1. Mike Bayer repo owner

    fixed in changeset:710. Will also look into relationships for the keynames if not found in the local set of property and column names, and generate the appropriate joins.

  2. Log in to comment