From ab1f65e6d773cce591e8779d84d8429f7d21d519 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Tue, 26 Feb 2013 10:15:26 -0600 Subject: [PATCH] Import sqlalchemy's and_ and use it in our select statement MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This commit sponsored by Hans-Jörg Dollansky. Thank you! --- mediagoblin/db/migrations.py | 5 +++-- 1 file 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): """ -- 2.25.1