3

I'm developing a card catalog type application and Python and am trying to decide how to store the data. Not a web app. I don't expect a large app or a massive amount of data.

One alternative is a pickled dictionary. For example {id1: {author1, title1}, id2: {author2, title2}} (reality would be a bit more complex). This has the virtue of simplicity. I could search items by iterating over the entries.

Another alternative is an sqlite database. This seems more suited for the task, including persistence and good facilities for adding, editing, searching, with the main downside being that I'm not too familiar with sql databases. OTOH, this looks like a good opportunity to learn.

Would you use sqlite3 or something else? Any other considerations for making the choice?

Any suggestions for learning sqlite beyond those in these questions python database / sql programming - where to start and https://stackoverflow.com/questions/2855031/comprehensive-beginners-tutorial-for-python-and-sqlite

asked Oct 23, 2011 at 14:59

1 Answer 1

1

Sqlite3 is a rock solid choice.

If you only need a key/value store, the shelve module offers and easy-to-use dictionary like API.

answered Oct 23, 2011 at 15:34
Sign up to request clarification or add additional context in comments.

2 Comments

The docs for sqlite3 are pretty good. Spending five minutes with the intro section should get you up and running (it shows how to make a connection, create a table, insert data in a table, and query the table). It is famously easy to use. docs.python.org/library/sqlite3.html#module-sqlite3
I've had some issues with shelve because it sometimes limits the size of the objects. I've found sqlitedict easy and convenient (pypi.python.org/pypi/sqlitedict)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.