Olemis Lang avatar Olemis Lang committed a096517

TracGViz: Flat schema before applying GViz QL expression transformations

Comments (0)

Files changed (1)

trac-dev/gviz/tracgviz/gvizql.py

 from re import compile
 from weakref import proxy
 
+from tracgviz.api import DataTable
 from tracgviz.util.parsing import OperatorPrecedenceParser,  \
     InvalidParserConfiguration
 
     return (sch, data)
   else:
     tq = GVizQLParser().parse(tq)
+    sch = provider.get_data_schema(*sch_args)
     data = provider.get_data(req, tq, **params)
-    sch = provider.get_data_schema(*sch_args)
-    return tq.transform(sch, data)
+    table = DataTable(sch)
+    # FIXME : Optimize memory
+    table.LoadData(data)
+    sch = [(col['id'], col['type']) + \
+        ( (col['label'],) if col.get('label') else () ) \
+        for col in table.columns]
+    data_seq = ( tuple(row.get(col['id']) for col in table.columns) \
+        for row in table._PreparedData() )
+        
+    return tq.transform(sch, data_seq)
 
 class Sequence(list):
   pass
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.