Partially Attended

an irregularly updated blog by Ian Mulvany

Django models vs. Pickling objects for object persistence.

Mon Oct 19, 2009

188 Words


I do a bit of code hacking and I often find myself putting objects into pickle files, and reading and writing them in order to fake object persistence. It's easy, but messy and it begins to leave lot's of pickle files sitting around in your path. I've decided to finally make the switch towards using a more grown up persistent object solution. I've decided to try out Django + SQLite. The former because I code in python, and Simon Willison uses it. The latter because I want to keep my system MySQL install pristine for another application that I am playing around with. I'm hoping that Django will hide the DB interface well away from me.



One of the key benefits that I hope to get out of this approach is to force myself into rigorously using Class based representations of model data, rather than naive python objects. I hope this will lead to cleaner and better documented code on my part. I also hope that a quick by-product will be to allow me to quickly prototype ideas onto the web via Google app engine.

We shall see.

This work is licensed under a Creative Commons Attribution 4.0 International License