Hi I'm not sure how exactly to describe my problem, or what parts of code to submit in support of this query. I have spent time Googling but, since I'm not sure how to define the problem, I'm not sure what to look for either. Sorry.
I have a feeling that my problem, somehow, relates to sessions, scoped sessions, transactions, flushes, refreshes, etc - somewhere in that "bundle". And I'm no expert in that department, basically using SQLAlchemy with whatever automatic settings it comes with, and flushing objects after fiddling with them. Oh, I'm using Elixir too. The actual database entries work perfectly though, without any persistence problems at all. My problem lies squarely with the objects in memory. After creating a child object, the parent's InstrumentedList always shows/reports two of the new child object. As I said, this situation is not persisted to the database at all. Perhaps a more to-the-point example snippet. I have Document objects that each have one or more DocumentStatus objects. So, in Document, the relation is defined as follows: statuses = OneToMany('DocumentStatus', inverse='doc', cascade='all, delete-orphan', order_by=['timestamp']) So, when I create a new DocumentStatus object, Document.statuses lists two of them, but not actually persisted to the database. In other words, leaving my Python shell, and starting the model from scratch, there actually is only one child object (corroborated by squizzing the database directly). Here's my DocumentStatus.create() class method: @classmethod @logged_in @log_input def create(cls, doc, status, person=None, date=None): person=validate_person(person) if person: status = DocumentStatus(doc=doc, status=status, person=person, date=resolve_datetime(date)) if status: doc.statuses.append(status) doc.flush() out = 'Document status created' success = True else: out = 'Document status not created' success = False else: out = 'Person does not exist' success = False log_output(out) return success I simply don't know why this is happening or, as I said, how to search, intelligently, for an answer. Help, or guidance as to what/where to search for a solution, would be greatly appreciated. Thanks -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.