Re: [sqlalchemy] AutomapBase without binding engine/tables individually?

2016-09-19 Thread Rahul Ahuja
y led me to believe that the base/engine require a schema. Any insight would be much appreciated. On Monday, September 19, 2016 at 8:09:29 PM UTC-7, Mike Bayer wrote: > > > > On 09/19/2016 08:43 PM, Rahul Ahuja wrote: > > Currently, I'm instantiating a new engine and declarative aut

[sqlalchemy] AutomapBase without binding engine/tables individually?

2016-09-19 Thread Rahul Ahuja
Currently, I'm instantiating a new engine and declarative automap base for each MySQL database I'd like to include in my session and then individually mapping reflected tables to the relevant engines. Some sample code to clarify: report_engine = create_engine(URL(drivername='mysql',

[sqlalchemy] Using Python functions in query with automap reflected tables?

2016-08-22 Thread Rahul Ahuja
I'm having some trouble using Python string functions on VARCHAR columns in MySQL (reflected using automap_base() and base.prepare). I'm getting AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' object associated with users.middlename has an attribute 'replace' when I

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
umnname > > > > On 08/12/2016 02:03 PM, Rahul Ahuja wrote: > > Thank you so much for the reply! I'm almost there but am having trouble > > selecting the abms_biog.id column from my subquery - I'm getting an > > "AttributeError: 'Alias' object has no attribute

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
e the .c. prefix - > alias.c.columnname > > > > On 08/12/2016 02:03 PM, Rahul Ahuja wrote: > > Thank you so much for the reply! I'm almost there but am having trouble > > selecting the abms_biog.id column from my subquery - I'm getting an > > "AttributeError: 'Ali

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
ed to use the .c. prefix - > alias.c.columnname > > > > On 08/12/2016 02:03 PM, Rahul Ahuja wrote: > > Thank you so much for the reply! I'm almost there but am having trouble > > selecting the abms_biog.id column from my subquery - I'm getting an > > "Attr

Re: [sqlalchemy] Updates with GROUP BY and subquery

2016-08-12 Thread Rahul Ahuja
a > strong need for this to be in expression language in any case, if your > textual SQL works fine. > > > > > > > On 08/12/2016 12:07 AM, Rahul Ahuja wrote: > > I'm trying to recreate the following SQL in SQLAlchemy: > > | &

[sqlalchemy] Updates with GROUP BY and subquery

2016-08-11 Thread Rahul Ahuja
I'm trying to recreate the following SQL in SQLAlchemy: update ignore abms_biog a join (select a.id, u.id as user_id from abms_biog a join 3md.users u on u.firstname = a.firstname and u.lastname = a.lastname and 3md.non_conflict_middlename(u.middlename, a.middlename)=1 and u.credentials in

[sqlalchemy] Stumped on bulk update with joins and GROUP BY. Any takers?

2016-08-11 Thread Rahul Ahuja
I'm trying to recreate the following SQL in SQLAlchemy: update ignore abms_biog_%s a join (select a.id, u.id as user_id from abms_biog_%s a join 3md.users u on u.firstname = a.firstname and u.lastname = a.lastname and 3md.non_conflict_middlename(u.middlename, a.middlename)=1 and u.credentials