From: Torsten Werner Date: Tue, 11 Jan 2011 20:47:23 +0000 (+0000) Subject: dbconn.py: reflect all views, too X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=73cc29e74bfe2a89b60429b881a0cb44e102344c;p=dak.git dbconn.py: reflect all views, too Signed-off-by: Torsten Werner --- diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 786aebde..baa16d04 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -2812,6 +2812,30 @@ class DBConn(object): 'udeb_contents', ) + views = ( + 'almost_obsolete_all_associations', + 'almost_obsolete_src_associations', + 'any_associations_source', + 'bin_assoc_by_arch', + 'bin_associations_binaries', + 'binaries_suite_arch', + 'binfiles_suite_component_arch', + 'changelogs', + 'file_arch_suite', + 'newest_all_associations', + 'newest_any_associations', + 'newest_source', + 'newest_src_association', + 'obsolete_all_associations', + 'obsolete_any_associations', + 'obsolete_any_by_all_associations', + 'obsolete_src_associations', + 'source_suite', + 'src_associations_bin', + 'src_associations_src', + 'suite_arch_by_name', + ) + # Sqlalchemy fails to reflect the SERIAL type correctly and that # is why we have to use a workaround. It can be removed as soon # as we switch to version 0.6. @@ -2825,6 +2849,10 @@ class DBConn(object): table = Table(table_name, self.db_meta, autoload=True) setattr(self, 'tbl_%s' % table_name, table) + for view_name in views: + view = Table(view_name, self.db_meta, autoload=True) + setattr(self, 'view_%s' % view_name, view) + def __setupmappers(self): mapper(Architecture, self.tbl_architecture, properties = dict(arch_id = self.tbl_architecture.c.id))