On Thu, 20 Oct 2005, Pierre Quentel wrote:

[EMAIL PROTECTED] a écrit :

My solution is sqlstring. A single-purpose library: to create SQL
statement objects.

With the same starting point - I don't like writing SQL strings inside Python code either - I have tested a different approach : use the Python list comprehension / generator expression syntax for the select requests

For instance :

s = query(r.name for r in planes if r.speed > 500)
for item in s:
        print s

query is a class whose instances are created with the generator expression as argument. The matching SQL request is built in the __init__ method, here :

SELECT r.name FROM planes AS r WHERE r.speed > 500

That, sir, is absolute genius.

Evil as fuck, but still absolute genius.

tom

--
NOW ALL ASS-KICKING UNTIL THE END
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to