search by alternate ID fails with MySQL

1 view
Skip to first unread message

JM

unread,
Nov 9, 2006, 4:39:21 PM11/9/06
to TurboGears
hello,

another issue that has been annoying me. I switched from sqlite to
MySQL, but suddenly a search by alternate ID fails, i.e my test code:

for t in Test.select():
try:
t2 = Test.byName(default_test_name)
log.debug('OK')
except:
log.debug('ERROR')
if t.name == default_test_name:
log.debug('FOUND')

would print:
ERROR
FOUND

switching back to sqlite, it works fine. The alternateID field has not
been modified since creation.

Obviously this is not a blocking issue, I can simply do a select, but I
was wondering if it is a known bug. I did not find a similar issue on
Track.

Regards,
JM

davi...@gmail.com

unread,
Nov 10, 2006, 5:26:18 PM11/10/06
to TurboGears
Can we please see your class declaration? This particular feature
works fine for me, so we're missing something here...

Thanks,

David

Robin Haswell

unread,
Nov 13, 2006, 7:14:44 AM11/13/06
to turbo...@googlegroups.com
davi...@gmail.com wrote:
> Can we please see your class declaration? This particular feature
> works fine for me, so we're missing something here...


Are you think reserved keyword collision? Because that's what I am :-)

-Rob

JM

unread,
Nov 14, 2006, 5:38:54 AM11/14/06
to TurboGears

davi...@gmail.com wrote:

> Can we please see your class declaration? This particular feature
> works fine for me, so we're missing something here...
>

Sorry I missed your message... it would be good if google groups
notified people when someone replies to their topic (also, "My Topics"
is empty, instead, they appear in "My Profile".. wtf?)

So, my class declaration is:

class Test(SQLObject):
name = UnicodeCol(length=64, alternateID=True)
...

Search "byName" works fine if I run with sqlite, but not with MySQL.

Thanks,
JM

JM

unread,
Nov 14, 2006, 5:42:14 AM11/14/06
to TurboGears

Robin Haswell wrote:

> Are you think reserved keyword collision? Because that's what I am :-)
>
> -Rob


Rob, thanks for your comment.
Do you mean it would be a name clash with the "Test" class name?

I thought this too and since then I renamed my class "WoeTest", but
still the same problem.

~JM

davi...@gmail.com

unread,
Nov 14, 2006, 12:31:37 PM11/14/06
to TurboGears
JM -

>Sorry I missed your message... it would be good if google groups
notified people when someone replies to their topic

Take a look at the "Email updates to me" link at the top of the thread.

Try taking your code out of the try...except block. Do a tg-admin
shell and enter:

t = Test.byName('myname')

and post the traceback here.

JM

unread,
Nov 15, 2006, 6:49:58 AM11/15/06
to TurboGears
> Take a look at the "Email updates to me" link at the top of the thread.

Thanks! :-)

> Try taking your code out of the try...except block. Do a tg-admin
> shell and enter:
>
> t = Test.byName('myname')
>
> and post the traceback here.

Cool, that solves my problem! I notied that I do a select byName with
an unicode string. This works with sqlite but fails with MySQL:

TypeError: decoding Unicode is not supported

JM

unread,
Nov 15, 2006, 9:09:52 AM11/15/06
to TurboGears
It looks like I've hit this bug:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1547743&group_id=74338

This is the 2nd annoying SqlObject Bug I'm hitting, just by doing
simple things. I can't wait for TG to dump this useless interface

~JM

Jorge Godoy

unread,
Nov 15, 2006, 12:34:55 PM11/15/06
to turbo...@googlegroups.com
"JM" <jmku...@gmail.com> writes:

Use a real database server. We can't dump MySQL :-)

--
Jorge Godoy <jgo...@gmail.com>

davi...@gmail.com

unread,
Nov 15, 2006, 2:27:52 PM11/15/06
to TurboGears
Try uninstalling/reinstalling the latest SQLObject. It looks like the
fix was checked in a couple of months ago, so this should be fixed now.
In fact, it works for me - I use Unicode with MySQL; I just installed
TG maybe 3-4 weeks ago.

Lee McFadden

unread,
Nov 15, 2006, 2:35:36 PM11/15/06
to turbo...@googlegroups.com

Or use SQLAlchemy and keep your database server.


--
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

Reply all
Reply to author
Forward
0 new messages