Skip to content

Q&A: General

Thor Whalen edited this page Oct 29, 2019 · 4 revisions

Q: Python has stuff like Object-Relational-Mappers (ORMs), a database API specification, etc. Why this?

Because py2store is neither of those. One thing python doesn't have much of are DAOs (Data Access Objects), which py2store offers, though that's not even the main point of it.

Consider the first paragraph of PEP 249: "This API has been defined to encourage similarity between the Python modules that are used to access databases. By doing this, we hope to achieve a consistency leading to more easily understood modules, code that is generally more portable across databases, and a broader reach of database connectivity from Python."

py2store aims at these goals, but focusing on the most commonly used operations. The idea is to be able to offer interface consistency when ever possible, but always allowing one to still bring in specifics if needed.

Q: You really expect me to learn yet another system?

Not at all. One of the things py2store aims to address: Not having to learn a new system. You already know dicts if you know python. Now for most operations, you can just pretend that your store is a dict, and py2store will take care of translating it to s3, mongoDB, sql, etc. You have plenty of stores you can use out-of-the-box. Of course, if you want/need to do something that is not covered, then you'll need to learn a few things on how to extend stores to your use case. But we try to make that easy as well.

Q: But I'm used to saying 'write' to write or 'read' to read data. I'll need to at least change that!

If you really want to use different words for the these operations you can. It's as easy as:

from py2store.trans import insert_aliases
insert_aliases(store, write='write', read='read', delete='remove', list='show', count='num_of_items')

and voilà: You can now have those methods you like to use: write, read, remove, show, and num_of_items!

Clone this wiki locally