Re: [sqlalchemy] Using column name instead of key in constraints

2017-10-02 Thread Zac Goldstein
Thanks for the detailed response. I do keep track of these conversions in a dictionary, but some of my constraints are made before the column keys are set, which probably sounds entirely backwards. I'll figure something out though -- at worst I can always parse the string. My use case is far

Re: [sqlalchemy] Selected subqueries with table inheritance don't correlate correctly

2017-10-02 Thread Mike Bayer
On Mon, Oct 2, 2017 at 10:12 AM, Michael Williamson wrote: > On Mon, 2 Oct 2017 10:00:43 -0400 > Mike Bayer wrote: > >> On Mon, Oct 2, 2017 at 7:18 AM, Michael Williamson >> wrote: >> > I'm trying to select a

Re: [sqlalchemy] Selected subqueries with table inheritance don't correlate correctly

2017-10-02 Thread Michael Williamson
On Mon, 2 Oct 2017 10:00:43 -0400 Mike Bayer wrote: > On Mon, Oct 2, 2017 at 7:18 AM, Michael Williamson > wrote: > > I'm trying to select a value using a correlated subquery that uses > > table inheritance, but the generated query seems to

Re: [sqlalchemy] Selected subqueries with table inheritance don't correlate correctly

2017-10-02 Thread Mike Bayer
On Mon, Oct 2, 2017 at 7:18 AM, Michael Williamson wrote: > I'm trying to select a value using a correlated subquery that uses table > inheritance, but the generated query seems to leak the table from the > subquery into the outer query. For instance, suppose employee

Re: Recommended logger for migration scripts

2017-10-02 Thread Mike Bayer
On Sun, Oct 1, 2017 at 7:41 PM, wrote: > I've used in my generated migration script: > > log = logging.getLogger(__name__) > log.setLevel(logging.INFO) > > for now and that seems to work; quick glance at Alembic’s code indicates > that’s what Alembic uses as well. The

Re: [sqlalchemy] Using column name instead of key in constraints

2017-10-02 Thread Mike Bayer
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.

[sqlalchemy] Selected subqueries with table inheritance don't correlate correctly

2017-10-02 Thread Michael Williamson
I'm trying to select a value using a correlated subquery that uses table inheritance, but the generated query seems to leak the table from the subquery into the outer query. For instance, suppose employee is a table, engineer inherits from employee, and each employee has a foreign key to a