diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-02-26 10:15:26 -0600 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-02-26 10:15:26 -0600 |
commit | ab1f65e6d773cce591e8779d84d8429f7d21d519 (patch) | |
tree | 38eed134e72235133b48e5413c3b5c4dd497f029 | |
parent | 0b7cdb6f3ec1c6e053df02434ead8714dc0cb32f (diff) | |
download | mediagoblin-ab1f65e6d773cce591e8779d84d8429f7d21d519.tar.lz mediagoblin-ab1f65e6d773cce591e8779d84d8429f7d21d519.tar.xz mediagoblin-ab1f65e6d773cce591e8779d84d8429f7d21d519.zip |
Import sqlalchemy's and_ and use it in our select statement
This commit sponsored by Hans-Jörg Dollansky. Thank you!
-rw-r--r-- | mediagoblin/db/migrations.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index 0a3bf825..e9b4e9ef 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -21,6 +21,7 @@ from sqlalchemy import (MetaData, Table, Column, Boolean, SmallInteger, ForeignKey) from sqlalchemy.exc import ProgrammingError from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.sql import and_ from migrate.changeset.constraint import UniqueConstraint from mediagoblin.db.migration_tools import RegisterMigration, inspect_table @@ -218,8 +219,8 @@ def mediaentry_new_slug_era(db): # that already exist return db.execute( media_table.select( - media_table.c.uploader==uploader, - media_table.c.slug==slug).count()).first().tbl_row_count + and_(media_table.c.uploader==uploader, + media_table.c.slug==slug)).count()).first().tbl_row_count def append_garbage_till_unique(row, new_slug): """ |