[Formed-commits] r439 - trunk/formed/formed/plugins/export

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 21 17:27:47 CET 2011


Author: bricks
Date: 2011-02-21 17:27:46 +0100 (Mon, 21 Feb 2011)
New Revision: 439

Modified:
   trunk/formed/formed/plugins/export/new_sql.py
Log:
write column names in create view statement


Modified: trunk/formed/formed/plugins/export/new_sql.py
===================================================================
--- trunk/formed/formed/plugins/export/new_sql.py	2011-01-19 10:59:45 UTC (rev 438)
+++ trunk/formed/formed/plugins/export/new_sql.py	2011-02-21 16:27:46 UTC (rev 439)
@@ -808,8 +808,10 @@
                 raw_table, joins, linear = tup
                 table = raw_table.name
                 tab = sqlName(table)
-                pfeil("CREATE OR REPLACE VIEW %s_view\nAS SELECT %s.* FROM %s\n" % (
-                    tab, tab, tab))
+                pfeil("CREATE OR REPLACE VIEW %s_view\nAS SELECT \n" % tab)
+                pfeil(",\n".join(["     %s.%s AS %s" % (tab, column.name, column.name)
+                    for column in raw_table.columns]))
+                pfeil("\nFROM %s\n" % tab)
 
                 njoins   = joins
                 oldTable = table



More information about the Formed-commits mailing list