[sqlalchemy] Is there a way to configure session.commit() so that it automatically return the committed instance's class.__name__ + primary id?

2017-07-24 Thread Jinghui Niu
I was wondering if there is a way to configure Session.commit() so on each successful commit, it will return the committed/updated/deleted instance's class.__name__ + row.id. Is this possible? Thanks. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

Re: [sqlalchemy] Inverse the mapping in a composite association proxy

2017-07-24 Thread Mike Bayer
On Mon, Jul 24, 2017 at 6:01 PM, Ruben Di Battista wrote: > Would cause again an IntegrityError. So I modified the recipe like this: >@event.listens_for(Session, "after_attach") >def after_attach(session, instance): ># when UserCourse objects are

Re: [sqlalchemy] Inverse the mapping in a composite association proxy

2017-07-24 Thread Ruben Di Battista
I'm playing a bit with composite Association Proxies and stumbled upon this discussion. Just wanted to point out that here: @event.listens_for(Session, "after_attach") def after_attach(session, instance): # when UserCourse objects are attached to a Session, # figure out what

[sqlalchemy] SQLAlchemy 1.2.0b2 released

2017-07-24 Thread Mike Bayer
SQLAlchemy release 1.2.0b2 is now available. This release repairs an issue in the test suite that would prevent the suite from passing on Python version 3.6.2. The release is made at the same time as that of release 1.0.18 and 1.1.12. Also included are fixes related to ORM use of JSON NULL

[sqlalchemy] SQLAlchemy 1.1.12 released

2017-07-24 Thread Mike Bayer
SQLAlchemy release 1.1.12 is now available. This release repairs an issue in the test suite that would prevent the suite from passing on Python version 3.6.2. The release is made at the same time as that of release 1.0.18 and 1.2.0b2. Also included are fixes related to ORM use of JSON NULL

SQLAlchemy 1.1.12 released

2017-07-24 Thread Mike Bayer
SQLAlchemy release 1.1.12 is now available. This release repairs an issue in the test suite that would prevent the suite from passing on Python version 3.6.2. The release is made at the same time as that of release 1.0.18 and 1.2.0b2. Also included are fixes related to ORM use of JSON NULL

SQLAlchemy 1.0.18 released

2017-07-24 Thread Mike Bayer
SQLAlchemy release 1.0.18 is now available. This release repairs an issue in the test suite that would prevent the suite from passing on Python version 3.6.2. The release is made at the same time as that of release 1.1.12 and 1.2.0b2. Additionally, a backport from release 1.1.7 allowing cx_Oracle

[sqlalchemy] SQLAlchemy 1.0.18 released

2017-07-24 Thread Mike Bayer
SQLAlchemy release 1.0.18 is now available. This release repairs an issue in the test suite that would prevent the suite from passing on Python version 3.6.2. The release is made at the same time as that of release 1.1.12 and 1.2.0b2. Additionally, a backport from release 1.1.7 allowing cx_Oracle

Re: [sqlalchemy] Association proxy in classical mapping keeping the business logic and the db schema separated

2017-07-24 Thread Mike Bayer
On Mon, Jul 24, 2017 at 4:40 AM, Ruben Di Battista wrote: > Thanks for taking the time to answer. > > Doing what you say means that then I have to import the models classes from > the sql.py module instead of the models.py. Am I right? your top example shows the model

Re: [sqlalchemy] Association proxy in classical mapping keeping the business logic and the db schema separated

2017-07-24 Thread Ruben Di Battista
Thanks for taking the time to answer. Doing what you say means that then I have to import the models classes from the *sql.py* module instead of the *models.py*. Am I right? Or the association_proxy attribute is then available to the original class (as it happens when using mapper)? I'm not