Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup rethinkdb with django?

I have followed various posts and tutorials but couldn't find anything that is relevant. I found a ORM for rethinkdb "https://github.com/dparlevliet/rwrapper" but don't know how to use it? I am new to to django and python.

like image 615
Viking93 Avatar asked Oct 19 '22 19:10

Viking93


2 Answers

It depends on what you want to do.

  • There is no way to simple replacement of Django's ORM with RethinkDB now. However, working with RethinkDB driver is simple enough, and similar to how you would use Django ORM.
  • The nearest thing is indeed rwrapper, you can try starting with this tutorial.
  • If you don't need to use Model classes, then you just need to find a place to connect to database (or use some sort of Singleton or Factory to connect to the database), and then just import rethinkdb as r and r.connect() and then just write queries with ReQL.
  • If you need realtime data, then Django is not suitable for that at all. You can consider mixing Django with Tornado
like image 98
analytik Avatar answered Nov 01 '22 15:11

analytik


Django doesn't support RethinkDB at the moment and I don't think there's any plan for it as well. Django developers don't add new stuff to the code base just because it's something new and might be cool. It should be really well mature and a high needs for it. So, I don't think you'll be hearing anything about RethinkDB from Django devs anytime soon.

This project might be something interesting: https://github.com/thejsj/django-and-rethinkdb

In order to use any database with Django, the adapter should completely be a Django DB Backend in order to work with:

  • Models
  • Admin
  • Forms
  • Various Class Based Forms
  • Session
  • Auth
  • etc...

In others words, as long as the db backend doesn't support all the django database operations is not something that you wanna use.

like image 41
Alireza Savand Avatar answered Nov 01 '22 15:11

Alireza Savand