Useful MySQL Routines
Tino Wildenhain
tino at wildenhain.de
Sun Apr 19 10:52:38 EDT 2009
Lawrence D'Oliveiro wrote:
> In message <mailman.4148.1240135989.11746.python-list at python.org>, Tino
> Wildenhain wrote:
>
>> Lawrence D'Oliveiro wrote:
>>> I've done a writeup on some of the basic routines I frequently use here
>>> <http://codecodex.com/wiki/index.php?title=Useful_MySQL_Routines>.
>> Why is that specific to mysql?
>
> Because that's all I've used so far. Though sqlite looks interesting for
> single-user stuff...
There are other more powerfull free alternatives to MySQL as well :)
>> Btw, the bulkinserter could be better done by using executemany
>> and select usefull batch sizes.
>
> Hmm, I've never bothered with executemany. The code as written copes
> comfortably with 10,000 records or so.
Would be interesting to see the difference. However executemany
would be much more portable - and as I see it transfers at least
a bit less data over the wire.
>> If you allow query construnction
>> better don't forget appropriate quoting of table- and column names
>> too to be on the safe side.
>
> Hmm, I never worried about that, because I was I tried to be careful in the
> names I chose. And I've never allowed object names to come from user input
> :).
Not you, but if others use it, it might be that they don't see a problem
and then - oops :)
> Besides, how do you deal with characters that are still illegal when quoted
> <http://dev.mysql.com/doc/refman/5.0/en/identifiers.html>?
Don't know. I personally avoid dealing with mysql altogether (I mean,
commands hidden in sql comments? Heaven! :)
Cheers
Tino
More information about the Python-list
mailing list