Re: [sqlalchemy] query.delete(fetch) gets confused by aliased

2016-02-02 Thread Rick Otten
supplemental filters before calling delete. Thanks for taking a look! On Tue, Feb 2, 2016 at 9:56 AM, Mike Bayer <mike...@zzzcomputing.com> wrote: > > > On 02/02/2016 09:05 AM, Rick Otten wrote: > >> >> > However, when the fetch query actually run

Re: [sqlalchemy] query.delete(fetch) gets confused by aliased

2016-02-02 Thread Rick Otten
> > >> > However, when the fetch query actually runs, it includes the non aliased >> > table name as well as the aliased table name in the from statement: >> > >> > select t.idfrom *some_table, some_table as t* where t.some_column = >> > /someValue/ >> >> well that's not a DELETE

[sqlalchemy] query.delete(fetch) gets confused by aliased

2016-02-01 Thread Rick Otten
When I used "aliased" with query.delete(), the fetch query seems to get confused. - I'm using SQLAlchemy 1.0.11, which 'pip' tells me is the latest version. - My backend database is PostgreSQL 9.5 Code snippet: from sqlalchemy.orm import aliased myTable = aliased(some_table,

[sqlalchemy] print query _mapper_zero_or_none()

2015-06-24 Thread Rick Otten
I've been using the literalquery function as described in the top answer on this Stackoverflow page for the past year or so: http://stackoverflow.com/questions/5631078/sqlalchemy-print-the-actual-query I found it very easy to add extra types to it. It has been really handy. I use it in

[sqlalchemy] one to many relationship

2014-07-31 Thread Rick Otten
I'm using sqlalchemy 0.8.7 on python 2.7.8. Here is my test case: #!/usr/bin/env python from sqlalchemy import Column, ForeignKey from sqlalchemy.orm import relationship, backref from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.dialects.postgresql import *

Re: [sqlalchemy] one to many relationship

2014-07-31 Thread Rick Otten
That ForeignKey definition looks wrong - it should point at a column, not a class. I think you want: ForeignKey(parent.parent_id) Interesting, thanks, in the case where I use the same 'Base' for both classes, that solves it. In PostgreSQL the column definition isn't required if

Re: [sqlalchemy] outerjoin condition matching tuples

2014-04-21 Thread Rick Otten
, Rick Otten rottenw...@gmail.comjavascript: wrote: So FWIW, for now, I cast all three columns into strings and concatenated them using the column_property() expression in the mapper, and then did the comparison on that. It worked ok to create the join condition I needed. It wasn't a pretty

[sqlalchemy] outerjoin condition matching tuples

2014-04-20 Thread Rick Otten
I would like to apply a condition in an outer join that matches a multi-item list rather than a single value. In other words, I'm trying to get SQLAlchemy 0.8.6 connecting to PostgreSQL 9.3.4 to generate SQL like this: select * from mytable mt left outer join myothertable mo

[sqlalchemy] Re: outerjoin condition matching tuples

2014-04-20 Thread Rick Otten
can hit my deadline for tomorrow morning. On Sunday, April 20, 2014 2:38:21 PM UTC-4, Rick Otten wrote: I would like to apply a condition in an outer join that matches a multi-item list rather than a single value. In other words, I'm trying to get SQLAlchemy 0.8.6 connecting to PostgreSQL