[dataimport] massive_store: reformat sql query
authorSamuel Trégouët <samuel.tregouet@logilab.fr>
Tue, 15 Dec 2015 10:28:39 +0100
changeset 11018 1df243392d45
parent 11017 3dfed980071c
child 11019 36838a012ccc
[dataimport] massive_store: reformat sql query
dataimport/massive_store.py
--- a/dataimport/massive_store.py	Mon Dec 21 12:47:35 2015 +0100
+++ b/dataimport/massive_store.py	Tue Dec 15 10:28:39 2015 +0100
@@ -728,12 +728,16 @@
     def application_constraints(self, tablename):
         """ Iterate over all the constraints """
         sql = '''SELECT i.conname as "Name"
-                 FROM pg_catalog.pg_class c JOIN pg_catalog.pg_constraint i
-                 ON i.conrelid = c.oid JOIN pg_catalog.pg_class c2 ON i.conrelid=c2.oid
+                 FROM pg_catalog.pg_class c
+                 JOIN pg_catalog.pg_constraint i ON i.conrelid = c.oid
+                 JOIN pg_catalog.pg_class c2 ON i.conrelid=c2.oid
                  LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner
                  LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
-                 WHERE c2.relname = '%s' AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
-                 AND pg_catalog.pg_table_is_visible(c.oid);''' % tablename
+                 WHERE
+                   c2.relname = '%s'
+                   AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
+                   AND pg_catalog.pg_table_is_visible(c.oid)
+                 ''' % tablename
         indexes_list = self.cnx.system_sql(sql).fetchall()
         constraints = {}
         for name, in indexes_list: