The problem with that one would be that you can only make INTERNORDERs (Stock->Stock). The problem is that the relations are not nullable but depend on the type of order.
I have no clue how to solve this. On 16-jun-2006, at 5:24, Michael Bayer wrote: whats wrong with this ?
order_types --------------- type_id name from_stock_id to_stock_id
? On Jun 15, 2006, at 6:44 PM, Koen Bok wrote: Within my organisation we have orders. Orders move products between three entities: Suppliers, Stocks and Customers.
The type of an order gets defined by the origin and the destination it is moving products. This way we can have the following types of orders:
From: To: -> Stock BUYORDER Stock -> Supplier RETOURBUYORDER Stock -> Stock INTERNORDER Stock -> Customer SELLORDER Customer ! -> Stock RETOURSELLORDER
How can I design objects/mappers to do this:
>>> order = session.query(Order).get(1) >>> print order.type <Type id=123 name='INTERNORDER' from=<Stock id=2> to=<Stock id=4>>
>>> order = session.query(Order).get(2) >>> print order.type <Type id=456 name='SELLORDER' from=<Stock id=4> to=<Customer id=1928>> _______________________________________________ Sqlalchemy-users mailing list
|
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users