Re: [SQLObject] Illegal names in MySQL
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Petr J. <pet...@tp...> - 2009-09-13 09:49:28
|
2009/9/13 Alex <xk...@gm...> > How to use illegal names for MySQL with SQLObject? > In pure SQL it is possible to use backuotes, say: > SELECT `select from` FROM table1 WHERE 1; > ...can be used to select the field called `select from`. > My situation is that I already have a DB which I'm trying to connect > with SQLObject to. MySQL throws an error because the table has illegal > names. > Is it possible to tell SQLObject to utilize backquotes? > Hi, maybe you can just try to experiment with: >>> class User(SQLObject): ... ... class sqlmeta: ... # user is a reserved word in some databases, so we won't ... # use that for the table name: ... table = "user_table" ... (taken from http://www.sqlobject.org/SQLObject.html ) and with dbName class Cenktgm01(SQLObject): class sqlmeta: idType = str idName = 'OID$CENKTGM01' nazev = UnicodeCol(dbName="nazev", dbEncoding = "1250") skupina = StringCol(length = 30) You can also switch: _connection.debug = True You will see the SQL output. I have found it very useful. HTH Petr |