the column order_adjustment.order_id has two conflicting foreign key  
definitions on it, which is not valid.  fixing that is the first step.

then if you are creating a relationship between mappers using an  
explicit primaryjoin, and neither side of the relationship is a  
foreign key (which is acually the case here since the ForeignKey and  
ForeignKeyConstraint objects on the table are conflicting with each  
other), you have to specify the "foreignkey" argument which is a  
table column or list of columns that represent the remote side of the  
relationship.

On Jul 21, 2006, at 1:17 PM, Yuan HOng wrote:

> The attached test program generates the following exception with SA
> 0.2.6. What does the error:
>
> Cant determine relation direction 'set([])'
>
> mean?
>
> Traceback (most recent call last):
>  File "test.py", line 56, in ?
>    order=Order()
>  File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 423,  
> in init
>  File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 161,  
> in compile
>  File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 387, in
> _initialize_properties
>  File "build\bdist.win32\egg\sqlalchemy\orm\mapper.py", line 1129,  
> in init
>  File "build\bdist.win32\egg\sqlalchemy\orm\properties.py", line 236,
> in do_init
>  File "build\bdist.win32\egg\sqlalchemy\orm\properties.py", line 298,
> in _get_direction
> sqlalchemy.exceptions.ArgumentError: Cant determine relation direction
> 'set([])', for 'order_adjustments' in mapper 'Mapper|Or
> derAdjustment|order_adjustment' with primary join
> 'orders.order_id = order_adjustment.order_id'
>
> The special thing about the test script is that the table
> 'order_item_adjustment' has foreign key relationships with both the
> table 'orders' and 'order_item'. And the column
> 'order_item_adjustment.order_id' is involved in BOTH of the two
> relationships. So maybe SA has difficulty in identifying the column
> involved in the relationship and I have to use primaryjoin to
> explicitly specify the join condition.
>
> What shall I do to create the relationships correctly?
>
> -- 
> Hong Yuan
>
> 大管家网上建材超市
> 装修装潢建材一站式购物
> http://www.homemaster.cn
> <test.py>
> ---------------------------------------------------------------------- 
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to  
> share your
> opinions on IT & business topics through brief surveys -- and earn  
> cash
> http://www.techsay.com/default.php? 
> page=join.php&p=sourceforge&CID=DEVDEV________________________________ 
> _______________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to