From: Christopher Allan Webber Date: Tue, 26 Feb 2013 16:15:26 +0000 (-0600) Subject: Import sqlalchemy's and_ and use it in our select statement X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ab1f65e6d773cce591e8779d84d8429f7d21d519;p=mediagoblin.git Import sqlalchemy's and_ and use it in our select statement This commit sponsored by Hans-Jörg Dollansky. Thank you! --- 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): """