[sqlalchemy] Custom secondary relation with composite primary keys

2017-04-28 Thread Alex Plugaru
Hello, There are 3 tables: `*Account*`, `*Role*`, `*User*`. Both `*Role*` and ` *User*` have a foreign key `*account_id*` that points to `*Account*`. A user can have multiple roles, hence the `*roles_users*` table which acts as the secondary relation table between `*Role*` and `*User*`. The

[sqlalchemy] Re: Cannot use func when bulk saving objects

2017-04-28 Thread Shane Carey
I was able to solve this by using a subquery instead of loading and updating, thanks anyway! -- 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

[sqlalchemy] Re: Cannot use func when bulk saving objects

2017-04-28 Thread Shane Carey
I just realized this line in the docs may be what I was missing - SQL expression inserts / updates (e.g. Embedding SQL Insert/Update Expressions into a Flush ) However, I still

[sqlalchemy] Cannot use func when bulk saving objects

2017-04-28 Thread Shane Carey
Hi, I found what I think to be a bug in the bulk save objects method. The following raises an exception: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Obj(Base): __tablename__ = 'obj_bulk_test' id