That is what I thought,
I removed it after it did give the same error, to be sure, I just tested that
again.
I also must say it might be something else I might need an relation since many
Objects can reference a single SerialNumber
Not sure what to do
relation ('….????…?? I have to think about that, it has to work the other way
around too
Thanks
Martijn
On Jan 18, 2012, at 22:39 , Conor wrote:
> On 01/18/2012 02:14 PM, Martijn Moeling wrote:
>>
>> I managed to get PG (9.0) installed and I am in the process over moving over
>> from MySQL,
>> I allready have stuff working and am now trying to get the main reason for
>> the Quick move: Sequence.
>>
>> I have a object like:
>>
>> seq=Sequence('serialnumber', metadata=Base.metadata)
>> Class Object1(Base):
>> Id = Column(Integer, primary_key=True)
>> SerialNumber = Column(Integer, seq) # Or whatever I try here
>>
>>
>> Class Object(Base):
>> Id = Column(Integer, primary_key=True)
>> SerialNumber = Column(Integer, ForeignKey('object1.SerialNumber')
>>
>>
>> with a create_all I get this:
>> (ProgrammingError) there is no unique constraint matching given keys for
>> referenced table "object1"
>>
>> I might be looking in the wrong direction here, the documentation only talks
>> about Sequence with primary_key set to True
>>
>> Martijn
> PostgreSQL requires the target of a foreign key (Object1.SerialNumber in your
> case) to have a unique constraint on it. Adding "unique=True" to the column
> definition would do it.
> -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.
--
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.