On 10/28/2010 06:57 AM, Fabien wrote:
> I got a problem with PostGreSQL 8.4 and tables reflection. My metadata
> object seems to be ok (it has foreign keys, primary keys, every
> columns and tables). But when I try to associate an object to an
> another one through a Foreign key, I get :
> "sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt type
> 'EventParameters' 'INSERT INTO event (".
>
> Here, my code :
> http://nopaste.info/d3d74b436e.html
>
> And my database schema :
> http://nopaste.info/8798dcf247.html
>
> What's wrong ? :/
>
> Thank you in advance
> Fabien
In this line:
e.eventparametersid=ep
you are assigning an object instance to a column, which is invalid. You
need to add a relationship "Event.eventparameters" that will allow you
to assign object instances:
mapper(Event,
metadata.tables['event'],
properties={'eventparameters': relationship(EventParameters)})
[...]
e.eventparameters = ep
-Conor
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.