link_to_name is on foreign keys because of the "remoteness" of the
other table, and this flag was added specifically for the reflection
feature, which makes use of link_to_name internally to line up foreign
key columns to an existing table that might be using a key separate
from name for a column.

For a UniqueConstraint or Index, those are made with immediate
knowledge of the Table in question and within the Table reflection
routine there is a dictionary of col names to columns passed around
for this operation so that any user-defined keys don't get in the way
of linking up these constraints to the table.

So while you could make yourself a dictionary of column name->column
and use that, that's all the reflection process does internally in any
case, there's no option that does this automatically outside the
reflection process itself.

Background on what it is you're trying to do would make it more clear
if additional features should be added.


On Sat, Sep 30, 2017 at 6:43 PM, Zac Goldstein <[email protected]> wrote:
> Is it possible to use column names instead of keys when creating table
> constraints?  I know ForeignKeyConstraint/ForeignKey have a link_to_name
> parameter which I've been able to use, but I haven't found a similar option
> for other constraints.
>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full
> description.
> ---
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to