I agree with both... It's much easier to write code using SQL right in the Tcl. The second you extract those queries, though, the queries should be removed from the Tcl file. I find that the general niceness of having a little bit of reminder code in the Tcl file to give me the gist of what's going on is totally outweighed by my propensity to start editing that query and then scratch my head for a few minutes (or more) when it does nothing to the app. Luckily now conditioning has kicked in and I figure out the problem pretty quickly or manage to avoid it altogether, but it was a painful pavlovian experience that I wouldn't wish on anybody else.