Python has ORM for SQL and NoSQL

I am creating an application that I want to publish, I will write an application in Python. I do not want to block the use of any particular sql / nosql database in my application. How can I create an application or model layer in order not to use the SQL / NOSQL method for storing data.

Is there an ORM that plays both types of storage? I did not find him. Normally I would use sqlalchemy so that people can use MySQL / PostgreSQL / MSSQL / etc if they want to, but adding NOSQL to the image seems more complicated than I originally thought.

I have some requirements, for example:

  • I do not want to use any backend for storage, which means that it does not scare people from using the application.
  • it must support data schema migration (during installation or upgrade)

If you have ideas on how I can use these requirements, I would appreciate help. Is it possible to create such a structure:

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

thanks

+6
source share
3 answers

There is nothing like it.

ORM or RDBMS can rely on SQL as the minimum standard for abstracting a subclass database. Most ORMs are built on top of the Python DB API (which is more or less fully implemented by all Python RDBMS relationships).

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

So, nothing of the kind works for both worlds.

There were approaches to define a common query language for NoSQL.

For example, JsonIQ

http://www.jsoniq.org/

But in fact, you have nothing to help in reality.

+4
source

You should try the JSONiq implementation for www.28.io. Its available as a cloud service or Premise.

0
source

The closest I saw was the django-nonrel abstraction layer. This is a django fork that supports the Mongo database, Google NoSQL and some others.

It was promising at one time, but since the django community generally rejected the idea of ​​adding NoSQL, it lagged behind.

0
source

Source: https://habr.com/ru/post/955432/


All Articles