Spent several hours reading available documentation and searching
samples, but no result...

Having schema (Oracle):

CREATE TABLE user_ (
    id NUMBER(16)
    CONSTRAINT pk_user PRIMARY KEY,
    name VARCHAR2(32) NOT NULL
);

CREATE TABLE case (
    id NUMBER(16)
    CONSTRAINT pk_case PRIMARY KEY,
    name VARCHAR2(32) NOT NULL
);

CREATE TABLE case2user (
    case_id NUMBER(16) NOT NULL
    CONSTRAINT fk_c2u_case REFERENCES case (id),
    user_id NUMBER(16) NOT NULL
    CONSTRAINT fk_c2u_user REFERENCES user_ (id),

    CONSTRAINT pk_case2user PRIMARY KEY (case_id, user_id)
);

and mapping it as:

class User(Entity):
    using_options(
        tablename='USER_',
        autoload=True
    )
    cases = ManyToMany(
        'Case',
        tablename='CASE2USER',
        remote_side='case_id',
        local_side='user_id'
    )


class Case(Entity):
    using_options(
        tablename='CASE',
        autoload=True
    )
    users = ManyToMany(
        'User',
        tablename='CASE2USER',
        remote_side='user_id',
        local_side='case_id'
    )

setup_all() passes ok

but

User.query.all()

results in

<class 'sqlalchemy.exc.ArgumentError'>: Could not determine join
condition between parent/child tables on relation Case.users.  Specify
a 'primaryjoin' expression.  If this is a many-to-many relation,
'secondaryjoin' is needed as well.

According to Elixir API documentation primaryjoin and secondaryjoin
should be determined automatically in this case. Any idea where I'm
wrong?

Many thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to