id column as a primary key not wanted

10 views
Skip to first unread message

beatpanic

unread,
Sep 3, 2011, 7:32:19 AM9/3/11
to Project Camelot
Hi, in my application I have a "legacy" (read pre-built) database
which I am autoload-ing in this way:

class Area(Entity):
using_options(tablename='areas', autoload=True)

I have Camelot==11.05.13

Camelot complains in this way:

ERROR:camelot.view.model_thread.signal_slot_model_thread:exception
caught in model thread while executing _update_unflushed_rows
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/camelot/view/
model_thread/signal_slot_model_thread.py", line 57, in execute
result = self._request()
File "/usr/local/lib/python2.7/dist-packages/camelot/view/
model_thread/__init__.py", line 57, in wrapper
return original_function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/camelot/view/proxy/
collection_proxy.py", line 296, in _update_unflushed_rows
for i, e in enumerate( self.get_collection() ):
File "/usr/local/lib/python2.7/dist-packages/camelot/admin/
object_admin.py", line 720, in get_collection
return [self.get_new_object()]
File "/usr/local/lib/python2.7/dist-packages/camelot/admin/
object_admin.py", line 716, in get_new_object
self._related_collection_proxy.append_object( self._new_object )
File "/usr/local/lib/python2.7/dist-packages/camelot/view/
model_thread/__init__.py", line 57, in wrapper
return original_function(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/camelot/view/proxy/
collection_proxy.py", line 1056, in append_object
self.append( obj )
File "/usr/local/lib/python2.7/dist-packages/camelot/view/proxy/
queryproxy.py", line 193, in append
if not o.id:
AttributeError: 'Area' object has no attribute 'id'

If it were possible I would avoid this 'id' field because I have other
primary keys in the db, hints? :)

thanks!

ciao,
Marco

Erik Janssens

unread,
Sep 4, 2011, 3:18:11 PM9/4/11
to project...@googlegroups.com
Hello Marco,

This was indeed a bug in Camelot. Camelot should not
rely on the name of the primary key or the number of
columns in it.

This is fixed in the trunk. Should you see other cases
of this happening, please report them.

Regards,

Erik

> --
> You received this message because you are subscribed to the "Project Camelot" group.
> Visit www.python-camelot.com for more information
>
> To post to this group, send email to project...@googlegroups.com
> To unsubscribe from this group, send email to
> project-camel...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/project-camelot?hl=en
>

beatpanic

unread,
Sep 4, 2011, 3:34:13 PM9/4/11
to Project Camelot

> This was indeed a bug in Camelot.  Camelot should not
> rely on the name of the primary key or the number of
> columns in it.
>
> This is fixed in the trunk.  Should you see other cases
> of this happening, please report them.

thanks Erik! I'll try it as soon as possible and let you know how it
goes.
I will surely report bugs if I will encounter them.

thanks again,
Marco
Reply all
Reply to author
Forward
0 new messages