[Rails] Re: Expose complex dynamic queries over REST
One approach would be to define a domain specific language and implement a compiler. This would give you an opportunity to check both the form (lexical scanner) and content (syntax checker) of the user input and map all legal requests on your data.
For obvious reasons, this language should not include the ability to pass SQL statements intact from the user to your database. But you could allow the user to implement a nice custom report generator to support analysis.
Racc is the gem capturing the syntax, it continues the tradition of recasting Stephen Johnson's YACC, which itself built on Donald Knuth's work. There isn't a lex/flex gem but ruby provides good support for lexical analysis.
On Friday, January 10, 2014 3:14:52 PM UTC-5, Colin Taylor wrote:
-- For obvious reasons, this language should not include the ability to pass SQL statements intact from the user to your database. But you could allow the user to implement a nice custom report generator to support analysis.
Racc is the gem capturing the syntax, it continues the tradition of recasting Stephen Johnson's YACC, which itself built on Donald Knuth's work. There isn't a lex/flex gem but ruby provides good support for lexical analysis.
On Friday, January 10, 2014 3:14:52 PM UTC-5, Colin Taylor wrote:
I'm trying to build a web application for data analysis. The client can send ad-hoc queries to my back-end data service. For example:(foo >= 10 OR bar == 'baz') AND bat < 10Is there a rails/activerecord standard for sending this type of query through REST? A DAO / method_missing won't work because there are an infinite number of permutations per model (e.g. an arbitrary number of attributes, clauses, etc). Is there something that could take a "Lucene-like" query string and construct an activerecord request? Or do I just have to manually parse it myself?
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/61f7a5b6-188c-4cb0-b35f-c071634deecc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home