Thanks for answer. I dynamicly create classes, their columns, their relationship. Add new works with new_instances, who will load after defintion, and already loaded classes who doesn't contain foreignkeys(for relationships). session.expire(attribute), does not work, because contained foreign key does not refreshed, and sqlalchemy think that is equal None
Kludge is look for adding foreign_keys and refresh them if refreshed_attribute is not None: for instance in gc.get_objects(): if isinstance(instance, refreshed_attribute['factory_class']): if instance in session.dirty or instance in session.deleted: session.refresh(current_instance, attribute_names = [refreshed_attribute['refreshed_attribute']]) elif instance in session and instance not in session.new: session.refresh(instance) -- 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 http://stackoverflow.com/help/mcve for a full description. --- 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 firstname.lastname@example.org. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.