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 = 
      elif instance in session and instance not in

SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See 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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to