Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python is there an ORM for SQL and NoSQL

Tags:

python

orm

I am building an app that I want to publish, I will write the app in Python. I don't want to lock down the use of any specific database sql/nosql to my app. How can I design the app or model layer to not enforce a SQL/NOSQL way to store the data.

Is there an ORM that plays with both type of storage? I didn't find one. Normally I would use sqlalchemy to make sure people can use MySQL/PostgreSQL/MSSQL/etc if they want, but adding the NOSQL to the picture seems more complicated than I initially thought.

I have some requirements like:

  • I don't want to enforce any storage backend, this is to ensure that it doesn't scare people from using the app.
  • it must support data schema migration (during installation or upgrade procedures)

If you have any idea how I can architecture these requirements I would appreciate the help. Is it possible to create a structure like this:

    +-----+
    + app +
    +-----+
       |
+-------------+
+ Data Access +
+-------------+
        |
+-----------+
+ SQL/NOSQL +
+-----------+

Thanks

like image 626
DoRivard Avatar asked Oct 07 '13 18:10

DoRivard


People also ask

Can I use ORM with NoSQL?

Data is automatically replicated between the two. The key to the NoSQL and SQL combination is the replication process, and that's where ORM comes into play. It provides an asynchronous, low-coding solution that updates the database from the NoSQL data store.

Can ORM map the NoSQL database in Django?

NoSQL is not supported by the ORM, but you can of course use NoSQL with other Django features, or alongside a relational database. What features are you looking for specifically? The data we receive from other applications are in purely JSON format. So that is the reason we wanted to include Nosql db (mongo db).

Does MongoDB have an ORM?

Using MongoDB removes the complex object-relational mapping (ORM) layer that translates objects in code to relational tables. MongoDB's flexible data model also means that your database schema can evolve with business requirements.

Can you use SQL and NoSQL together?

Using a NoSQL database doesn't mean you can't use SQL; SQL is just the query language. In fact, NoSQL and SQL can be complementary. Some NoSQL databases use SQL to search the data.


1 Answers

No there is nothing like that.

An ORM or a RDBMS can rely on SQL as minimal standard for abstracting the underlaying database. Most ORM are build on top of the Python DB API (which is implemented more or less complete by all RDBMS Python bindings).

For NoSQL there is neither a standard query language nor a standard driver API.

So there is nothing like that that works for both worlds.

There have been approaches for defining a common query language for NoSQL language.

For example there is JsonIQ

http://www.jsoniq.org/

But there is not much that help you in reality.

like image 73
Andreas Jung Avatar answered Sep 30 '22 17:09

Andreas Jung