X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=766efdb4a9e463f6b1b3837c3410037d2174a90c;hb=ad4d199f56e90f0614a29c80d4d4498313fcf75f;hp=227a8af130e4b77e8b25ea011f4c87adebf5aa9a;hpb=66fa53ec4bc5b812493197f55940c60280db364f;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 227a8af1..766efdb4 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -46,7 +46,7 @@ from inspect import getargspec import sqlalchemy from sqlalchemy import create_engine, Table, MetaData, Column, Integer -from sqlalchemy.orm import sessionmaker, mapper, relation, object_session +from sqlalchemy.orm import sessionmaker, mapper, relation, object_session, backref from sqlalchemy import types as sqltypes # Don't remove this, we re-export the exceptions to scripts which import us @@ -59,6 +59,16 @@ from config import Config from textutils import fix_maintainer from dak_exceptions import NoSourceFieldError +# suppress some deprecation warnings in squeeze related to sqlalchemy +import warnings +warnings.filterwarnings('ignore', \ + "The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to 'postgresql'.*", \ + SADeprecationWarning) +# TODO: sqlalchemy needs some extra configuration to correctly reflect +# the ind_deb_contents_* indexes - we ignore the warnings at the moment +warnings.filterwarnings("ignore", 'Predicate of partial index', SAWarning) + + ################################################################################ # Patch in support for the debversion field type so that it works during @@ -2842,8 +2852,10 @@ class DBConn(object): def __setupmappers(self): mapper(Architecture, self.tbl_architecture, - properties = dict(arch_id = self.tbl_architecture.c.id, - suites = relation(Suite, secondary=self.tbl_suite_architectures, backref='architectures', order_by='suite_name'))) + properties = dict(arch_id = self.tbl_architecture.c.id, + suites = relation(Suite, secondary=self.tbl_suite_architectures, + order_by='suite_name', + backref=backref('architectures', order_by='arch_string')))) mapper(Archive, self.tbl_archive, properties = dict(archive_id = self.tbl_archive.c.id,