[storm] Escaping columns names in mysql
Jamu Kakar
jkakar at canonical.com
Wed Oct 22 21:53:25 BST 2008
Hi Piotr,
Piotr Jackowski wrote:
> At the beginning I would like to remark that I'm new to Python and Storm.
Welcome! :)
> First of all I'm unable to load storm.tracer module:
> from storm.tracer import debug:
> ImportError: No module named tracer
> But probably this is an issue for ubuntu team and I can leave without
> it for now.
I believe the tracer module was released in 0.13. In the meantime,
you can do:
from storm import database
database.DEBUG = True
This will write SQL statements to stdout as they're being executed.
> The second issue more important.
> I wanted to use Storm with existing mysql database and one of the
> columns names is: 'long' which is also sql kyeword.
> So every time in my queries I have to escape colums names like for
> example: SELECT ... WHERE `long` = 100.
> And I think Strom doesn't escape columns names so it's completely
> useless for me :(
This is a bug. Storm does escape column names but 'long' is missing
from its list of reserved words. I believe you can do the following
to work around the bug for now:
from storm.databases import mysql
mysql.compile.add_reserved_word("long")
As an aside, you may want to consider avoiding reserved words for
column names, but you probably already know that. :)
Thanks,
J.
More information about the storm
mailing list