Hello!

Looks like the refresh_flush event is not triggered when the only field to 
update after flush is the primary key fed from RETURNING clause. However it 
should, as far as I understand what is mentioned in the documentation.

Environment: SQLAlchemy 1.0.14, PostgreSQL 9.5, Python 3.4

Here is how to reproduce this problem:

from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from sqlalchemy import event

Base = declarative_base()

def receive_refresh_flush(target, context, attrs):
    print('refresh_flush received')

class Test(Base):
    __tablename__ = 'refresh_flush_test'
    id = Column(Integer, primary_key=True)
    # uncomment the field below to receive the event
    # dummy = Column(Integer, default=0)

engine = create_engine('postgresql://test:test@localhost:5432/test')
Base.metadata.create_all(engine)
session = Session(engine)

event.listen(Test, 'refresh_flush', receive_refresh_flush)

obj = Test()
session.add(obj)
session.commit()

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to