Re: SQLAlchemy Queries & HTML Data Grid
Sorry, I must not really have explained clearly. This isn't an
abstraction layer, but more like a UI component or widgit that
facilities basic reporting. Look at these pages:http://www.redmine.org/issueshttp://trac.edgewall.org/query
Both pages have a similar structure:
- UI Controls
- column selection
- Paged/Sortable Recordset Display
The library would do the heavy lifting and allow any application using
SQLAlchemy to easily create such query/recordset interfaces to
You would need to:
- Instantiate the DataGrid class
- Create a base SQLAlchemy query to be used for the data
- Define the filter types associated with the columns (i.e.
TextFieldFilter, OptionsFilter('low','medium', 'high'), DateSpanFilter,
- Limit sorting, grouping to appropriate columns
- choose which columns of the dataset to show by defaults
The library would then:
- parse GET/POST for filter/column/sort/page settings &/or use
- compose SQLALchemy query to satisfy the request
- execute the query and get the database results
- put results into an HTML table
- return the HTML form needed for the controls and the recordset
table including necessary CSS and JS
Obviously, the library should be easily customizable and the rendering
of HTML should be flexible. It should also be flexible enough to work
with the different WSGI libraries out there.
I hope that makes better sense. If you or anyone else is interested, I
can give you some code I have working from the pysapp project which
does some basic filtering, paging, and sorting. The API is awful, but
I think it might give you a better idea of what I am talking about.
"Whether, then, you eat or drink or
whatever you do, do all to the glory
of God." 1 Cor 10:31
Aaron Watters wrote:
Thanks Randy, very interesting.
My initial reaction is that you are building a stack on top of a stack.
It's not clear to me what problem you want to solve
and your requirements are. It's possible that
you could find it easier to abstract directly on top of SQL or
you could consider using another sort of data model like mongodb.
Building an abstraction on top of SQLAlchemy which hasn't even reached
1.0 strikes me as dubious.
Thanks again, -- Aaron Watters
--- On Tue, 4/6/10, Randy Syring <rsyring-KjVcCr55iNUxpvK4C0GaPQ@public.gmane.org>
From: Randy Syring <rsyring-KjVcCr55iNUxpvK4C0GaPQ@public.gmane.org>
Subject: [Web-SIG] SQLAlchemy Queries & HTML Data Grid
Date: Tuesday, April 6, 2010, 4:37 PM
-----Inline Attachment Follows-----
Web-SIG mailing list
Web SIG: http://www.python.org/sigs/web-sig