Skip to content
Advertisement

Tag: sqlalchemy

Python dicts in sqlalchemy

I would like to load/save a dict to/from my sqlite DB, but am having some problems figuring out a simple way to do it. I don’t really need to be able to filter, etc., based on the contents so a simple conversion to/from string is fine. The next-best thing would be foreign keys. Please don’t post links to huge examples,

sqlalchemy flush() and get inserted id?

I want to do something like this: But f.id is None when I try it. How can I get this to work? Answer Your sample code should have worked as it is. SQLAlchemy should be providing a value for f.id, assuming its an autogenerating primary-key column. Primary-key attributes are populated immediately within the flush() process as they are generated, and

Advertisement