Hello, I am (ab)using sqlalchemy for versioning all my content. It allows me to do things like
session.query(Parent).options(VersionOption(target_version = 123)).filter(Parent.children.any(Child.name == 'c1')).all() and the result will reflect exactly the state at version 123. The querying part already works, at its heart the relationship between Parent and Child (one-to-many) looks like secondary = j primaryjoin = Child.parent_id == j.c.content_id secondaryjoin = j.c.content_id_at_version == Parent.id where j is an aliased select and join between several other tables to generate the "translation table" between arbitrary_content_id and the latest content which belongs to the same object. Now I'd also love to be able to do alice.children.append(Child(name = 'bob')) This currently gives me a Module sqlalchemy.orm.dependency:1124 in _run_crud >> statement = self.secondary.insert() AttributeError: 'Alias' object has no attribute 'insert' The 'Alias' object in question is the secondary select of the relationship of course. What I'd like it to do is just insert the pk of alice into bob.parent_id (i.e. it should behave if there was no secondary at all and instead a simple primaryjoin = Child.parent_id == Parent.id) >From reading the manual and sourcing the net I am not sure now if/how this case is supported, When I use viewonly=True I cannot insert anything anymore. I am aware I can create one property/relationship for reading and one for writing objects. But that's a bit ugly from the usage perspective I think. Maybe there is a way to tell sqlalchemy to treat writing into the one- to-many list differently from reading it? Does this make sense? -Matthias -- 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.