Lukas Lueg
unread,Dec 18, 2012, 4:39:30 AM12/18/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sqlal...@googlegroups.com
Hi,
I've to parse raw user input which ends up as filter-parameters for querys. Consider the following examples, which will end up as where-clauses against date- and decimal-columns (among others).
FooDate = 2005/12/04
FooDate = 04.12.2005
BarValue = 100,000.00$
BarValue = USD 100000
My question is >where< to put the code that will parse the right-hand-side-values and bring it to the appropriate type.
The database- and python-type can be inferred from reflection and the raw strings are parsed by regular expressions. My idea is to put this into types.TypeDecorators (e.g. process_bind_param()) so code building queries from raw user input does not have to care about doing type coercion itself.
Ideas?