Hi Jacek,
you cannot use parameter markers for identifiers such as database or
table names, they only work with the values that need quoting/escaping.
Cheers,
Andy
Jacek Becla wrote on 2015-04-21:
> Brian and I have troubles forcing sqlalchemy to do proper
> escaping/binding. The bottom line is that it is not clear
> how to do that even in plan mysqldb, we eg tried this:
>
>
> #!/usr/bin/python
>
> import MySQLdb
>
> con = MySQLdb.connect(unix_socket="/var/run/mysqld/mysqld.sock",
> user="becla") cursor = con.cursor()
>
> # this will create database called 'aaa' (with quotes!)
> # cursor.execute("CREATE DATABASE `%s`", ('aaa',))
>
> # all these reports "wrong syntax" error
> # cursor.execute("CREATE DATABASE %s", ('aaa',))
> # cursor.execute("CREATE DATABASE '%s'", ('aaa',))
>
> cursor.close()
> con.close()
>
>
> Are we missing something obvious???
>
> J.
>
> ########################################################################
> Use REPLY-ALL to reply to list
>
> To unsubscribe from the QSERV-L list, click the following link:
> https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=QSERV-L&A=1
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the QSERV-L list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=QSERV-L&A=1
|