Re: [sqlalchemy] Reflected Table FK

2020-12-31 Thread Matthew Graham
It makes sense that as foreign keys can be composite, that all foreign keys would be considered composite, thank you, I just had no idea that foreign keys could be composite in the same way that primary keys could be. Thanks again On Fri, Jan 1, 2021 at 8:29 AM Mike Bayer wrote: > A particular

Re: [sqlalchemy] Reflected Table FK

2020-12-31 Thread Mike Bayer
A particular column may be constrained by more than one foreign key constraint (although this is very uncommon), and a particular foreign key constraint may be "composite" in that it refers to multiple columns. All primary and foreign key constructs in SQLAlchemy are inherently composite.

Re: [sqlalchemy] Reflected Table FK

2020-12-31 Thread Matthew Graham
Are you saying with the multiple foreign keys that for each key, multiple columns can be used? I am aware that if you had table A and it had columns B_id and C_id that B_id may be a fk to B and C_id may be a reign key to C, but are you essentially saying there is an equivalence to a "composite"

Re: [sqlalchemy] Reflected Table FK

2020-12-31 Thread Mike Bayer
regarding "lists of columns", FOREIGN KEY constraints refer to sets of columns between local table and referred table, not just a single pair of columns. That a typical foreign key constraint might only link a single column in the local and referred tables is a special case.an application

Re: [sqlalchemy] Reflected Table FK

2020-12-31 Thread Mike Bayer
hey there - no need to deal with MetaData, Table, etc. just to get information about tables. Have a look at the inspector interface and get the information directly: https://docs.sqlalchemy.org/en/13/core/reflection.html#fine-grained-reflection-with-inspector Table, MetaData etc. objects are

[sqlalchemy] Reflected Table FK

2020-12-31 Thread Matthew Graham
Hi I am new to SQLAlchemy, I am trying to extract from reflected tables: 1. the column name of the current table 2. the referred table name and 3. the column name of the referred table now I can manage to do this using (and for sake only using first forein key) *metadata =