Forget about sql in 50 lines of python code
1–10 of 23 posts
Re: Forget about sql in 50 lines of python code
#2Re: Forget about sql in 50 lines of python code
#3Building SQL strings from user data is a terrible idea. You will have SQL injections. You will compromise your database. I'm sure someone else will add the obligatory link to the Johnny Droptables xkcd.
Just learn SQL. It is just not the hard. And please, please use bind variables.
Re: Forget about sql in 50 lines of python code
#4You probably want to escape the text.
Use the execute(QUERY[,optional parameters]) syntax.
http://stackoverflow.com/questions/902408/how-to-use-variabl...
Re: Forget about sql in 50 lines of python code
#5Re: Forget about sql in 50 lines of python code
#6On a side note, is SQL the only declarative language widely in use?
Note, I'm not talking about VBA - I am talking about Excel's formulas
Re: Forget about sql in 50 lines of python code
#7Re: Forget about sql in 50 lines of python code
#8This is useful for abstracting away some routine SQL queries, but I think people think simple selects and inserts are more routine than they are actually are.. If you structure your data layer in a way that takes advantage of the power of the RDMBS I find that the only query here is truly routine is insertion on a single row...
We already have a language for expressing relational database queries - SQL. Every time you abstract away this language you risk reducing its expressiveness.
Re: Forget about sql in 50 lines of python code
#9Re: Forget about sql in 50 lines of python code
#10All SQL DSLs seem a bit over-the-top to me; you're layering a DSL atop another DSL (SQL), forcing you to understand the former intimately, along with knowing the latter well enough to write decent queries.