tokejepsen Posted July 24, 2017 Report Share Posted July 24, 2017 Hey, I thought when you query, the data in memory got queried as well? I'm trying to do something like this: entity = session.create( "Sequence", {"parent": project, "name": "sq001"} ) print session.query('Sequence where parent.id is "{0}" and name is "sq001"'.format(project["id"])).first() But I seem to have to commit the session inbetween, so I'm guessing the query method only looks at the server? entity = session.create( "Sequence", {"parent": project, "name": "sq001"} ) session.commit() print session.query('Sequence where parent.id is "{0}" and name is "sq001"'.format(project["id"])).first() Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted July 25, 2017 Report Share Posted July 25, 2017 Yes, this is true - if you issue a session.query you will have to persist the data in order for it to show up. The session.get and using relations will retrieve it from the memory cache Link to comment Share on other sites More sharing options...
tokejepsen Posted July 25, 2017 Author Report Share Posted July 25, 2017 Is this a deliberate choice, or is session.query going to query the memory as well in the future? Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted July 25, 2017 Report Share Posted July 25, 2017 I think that would be a very complex implementation as the query that you currently write is translated to a database query. Link to comment Share on other sites More sharing options...
tokejepsen Posted July 25, 2017 Author Report Share Posted July 25, 2017 Ahh, I see. For some reason I thought the session caching was a kind of local database that then got merged with the remote database on commit. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.