Gaetan,

I'd like to revisit this topic, because I'm wondering if I can mix
both Elixir DSL statements and SQLAlchemy statements in order to get
the kind of many-to-many relationship I'm after.

If I do the following:

class A(Entity):
    has_field('name', String(30))

class B(Entity):
    has_field('name', String(30))

I will have deliberately left out the association table for the many-
to-many relationship I want between an A and a B.  Can I then (in the
same model.py file) do something like:

a_to_b_table = Table('a_to_b', metadata,
    Column('A_id', Integer, ForeignKey("A.A_id")),
    Column('B_id', Integer, ForeignKey("B.B_id"))

)

mapper(A, A_table, properties = dict(
    keywords = relation(B, secondary=a_to_b_table, lazy=False)
    )
)

I've no doubt gotten the code wrong in some way, but is it possible to
use this method to create the association table, and add the proper
many-to-many relationships


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