Python embedded data persistence that's simple, modifiable, and reliable -


looking python 2.7 is:

  • simple - , running without lot of overhead
  • modifiable - can handle changes come prototyping , frequent changes data schema
  • reliable - able recover no matter what, i.e. if there's power outage i'm not going lose entire data store because it's corrupt.

some candidates , comments:

  • text / csv / json file - seems simple, reliable if keep backup copy of file frequently, or implement simple backup-plus-journal setup (make backup of file when program starts, write changes journal file)
  • sqlite - simple , reliable, handling frequent changes seems little cumbersome.
  • shelve / marshal / cpickle - simple , modifiable, not sure how reliable it's going be. if file ends corrupted, seems you're sol. @ least human-readable file piece together.
  • zodb - might winner. i'm unclear, require objects inherit? i'd keep separation of persistence layer since initial prototyping , may change once schema hashed out.
  • sqlalchemy - small project, seems lot of overhead, , might use sqlite. maybe it's better elixir?

if mongodb embedded might perfect. sqlite great if solve changing schema problem. fits bill based on experiences?

zodb offers full acid compliance, fits reliability requirements.

any object inherit persistent becomes it's own separate record (changes recorded unit), don't have to. using persistent not required, recommended.

the zodb heavily relies on pickle module, __setstate__ hooks can used schema upgrades.

use zodb if data structure fits inherent tree structure zodb data naturally builds. indexing add-on operation, 1 need handle yourself. zope / plone uses events , dedicated catalog index interesting information objects, lets efficiently find objects again in large hierarchy.

if data more table-like in nature (piles of different information complex inter-relations), stick sql solution. text / csv / json / shelve / plain pickle not going reliable enough.

sqlalchemy easy enough use if know sql; excellent orm. elixir no longer maintained, sqlalchemy offers functionality project offered, natively. manage schema migrations sqlalchemy-migrate.

for simple projects using sqlite directly easy enough, migrating schema little more cumbersome. i've used schema_version pragma before detect when schema migration needed.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -