Ok, thanks!

Arnar

On 6/13/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
> you can define them for the purposes of querying and mapping just as
> separate ForeignKey objects (i.e ForeignKey(customer_id) on
> customer_id, ForeignKey(username) on username), and it will figure
> out all the appropriate join conditions connected by AND.
>
> for the purposes of having the metadata more closely resemble reality
> as well as issuing the proper CREATE statements, theres a ticket:
> http://www.sqlalchemy.org/trac/ticket/76
>
>
> On Jun 13, 2006, at 11:04 AM, Arnar Birgisson wrote:
>
> > Hi there..
> >
> > Is is it possible to describe multi-column foreign keys with SA
> > metadata?
> >
> > I.e.
> >
> > create table customers (
> > customer_id string,
> > primary key (customer_id)
> > )
> >
> > create table users (
> > customer_id string,
> > username string,
> > primary key (customer_id, username),
> > foreign key (customer_id) references customers (customer_id)
> > )
> >
> > create table preferences (
> > customer_id string,
> > username string,
> > preference_id string,
> > preference_value string,
> > primary key (customer_id, username, perference_id),
> > foreign key (customer_id, username) references users (customer_id,
> > username)
> > )
> >
> > This model is a made-up simplification of what I need to do.. but
> > basically it's the last foreign key I can't figure out if I can
> > describe with SA metadata.
> >
> > The only solution I see is to put a relation property on the "user"
> > mapper that uses a custom join condition. However, this is standard
> > SQL so shouldn't SA be able to handle this automatically if there is a
> > ForeignKey specification on the table-object?
> >
> > Arnar
> >
> >
> > _______________________________________________
> > Sqlalchemy-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>


_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to