Hi, I am trying to sote pairs in a table as follows:

#--------------------------------------------------------------------------------------
from elixir import *

metadata.bind = "sqlite:///:memory:"
metadata.bind.echo = False

class Pairs(Entity):
    name = Field(String(50), primary_key = True)
    other = OneToOne('Pairs', inverse = 'other')

    def __init__(self, name):
        self.name = name

def pair(name1, name2):
    p1, p2 = Pairs(name1), Pairs(name2)
    p1.other = p2

if __name__ == '__main__':

    setup_all()
    create_all()

    pair('p1', 'p2')
#--------------------------------------------------------------------------------------

I am not very famiiar with SQL etc. but logically this seems possible
(please orrect me if I am wrong). However I get the following error:
------------------------
File "D:\Documents\Code\Eclipse\workspace\SQLAdata\src\tests.py", line
22, in <module>
    setup_all()
  File "build\bdist.win-amd64\egg\elixir\__init__.py", line 94, in
setup_all

  File "build\bdist.win-amd64\egg\elixir\entity.py", line 951, in
setup_entities
  File "build\bdist.win-amd64\egg\elixir\entity.py", line 198, in
create_pk_cols
  File "build\bdist.win-amd64\egg\elixir\entity.py", line 481, in
call_builders
  File "build\bdist.win-amd64\egg\elixir\relationships.py", line 448,
in create_pk_cols
  File "build\bdist.win-amd64\egg\elixir\relationships.py", line 791,
in create_keys
  File "build\bdist.win-amd64\egg\elixir\relationships.py", line 521,
in inverse
AssertionError: Relationships 'other' in entity 'Pair' and 'other' in
entity 'Pair' cannot be inverse of each other because their types do
not form a valid combination.
------------------------

Can anyone help me to understand the error and possibly fix it?

Thanks in advance, Lars

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to