hi list,

I have the following (elixir) definitions

class Invoice(Entity):
    user_name = Field(Unicode(255))
    item = ManyToOne(Item)

class Item(Entity):
    item_id = Field(Integer,  primary_key=True)
    service_id = Field(Unicode(255),  primary_key=True)
    item_class = Field(Unicode(255),  primary_key=True)

I wish to select invoices that have distinct items

(Pdb) Session.query(Invoice.item.distinct())
*** RuntimeError: maximum recursion depth exceeded while calling a
Python object

this works
(Pdb) Session.query(Invoice.item_item_id.distinct())
<sqlalchemy.orm.query.Query object at 0x988e7ec>
but doesn't lead to the expected result

here is the invoice's table description

CREATE TABLE invoice (
        id INTEGER NOT NULL,
        user_name VARCHAR(255),
        item_item_id INTEGER,
        item_service_id VARCHAR(255),
        item_item_class VARCHAR(255),
        PRIMARY KEY (id),
        CONSTRAINT invoice_item_item_id_item_service_id_item_item_class_fk
FOREIGN KEY(item_item_id, item_service_id, item_item_class) REFERENCES
item (item_id, service_id, item_class)
)


How can I achieve my query ?

regards
NIL

-- 
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