0

I'm searching for the instructions on how to access data from RethinkDB in Django framework but couldn't find in Django official web site. I could install rethinkdb driver in python3.4 using pip, but could find no simple demo on how to use it in the models and views to access data and perform simple data access operations.

I'm learning RethinkDB and Reactjs, and found them very interesting to harness the power of real time web interactions.

My objective is to use these three, but couldn't find a simple demo on usage of these three [Python(Django) + RethinkDB + React JS].

Can someone help me by pointing to any simple demo on accessing data from RethinkDB and displaying on template in Django ?

If possible any simple demo which has all the three technologies for learning purpose.

Thanks a lot!

Satheesh Panduga
  • 779
  • 1
  • 8
  • 28
  • Django's ORM supports relational database engines, you can find the list here: https://docs.djangoproject.com/en/1.8/ref/settings/#engine and to use RethinkDB you will have to write your own data access layer – vedarthk Oct 13 '15 at 17:27
  • Hi, Thanks for the feedback!.. I have implemented, but couldn't retrieve the data from rethinkdb. Can you pls help ? http://stackoverflow.com/questions/33113672/how-to-retrieve-data-from-rethinkdb-via-django-view – Satheesh Panduga Oct 13 '15 at 23:15

1 Answers1

2

I see you've made a few StackOverflow questions regarding Django and RethinkDB:

Is this correct way to access RethinkDB in Django? How to retrieve data from RethinkDB via Django view?

But let me try to address the main problem here.

I think the overall answer is that RethinkDB cannot be the primary datastore for Django without some serious overhauling. It just makes more sense to keep the main datastore of Django as Postgres or some other SQL db. Where RethinkDB can assist Django is using it with middleware to give it some great reactive features with things like RethinkDB changefeeds. This will definitely take some considerable work though to get going.

But, if you're just trying to get started with using Reactjs, RethinkDB, and Python. I definitely recommend Bottle or Flask. Django is opinionated on how your app should be developed, using Flask is a bit more free-form and gives you some flexibility that you won't get with Django.

If you really like Django, by all means continue, but I think if learning is more your priority, I'd recommend trying a different framework that you won't have to break or bend too much to getting a working product.

If you have any thoughts/questions, hit me up at @dalanmiller.

dalanmiller
  • 2,897
  • 4
  • 24
  • 35
  • Hi, Thanks for your feedback! Am using mySQL as primary data store and RethinkDB as secondary (Just for storing some aggregates). Yea, I asked couple of questions related to using the RethinkDB from DJango. I figured out using both Django (for backend processing - MySQL) and Nodejs(for RethinkDB). – Satheesh Panduga Oct 19 '15 at 21:40
  • After storing some records into MySQL, I have the requirement to store some calculated values into RethinkDB via Python code in Django.. For this, I created middleware separately and got it working.. But I would like to seek your help on this - How safe is it to store data into RethinkDB directly using Python without any Django middle ware ? Any suggestions ? – Satheesh Panduga Oct 19 '15 at 21:43
  • Hey Sathish, by "safe" do you mean is your data being written to disk? If you are doing a `r.db("example").table("examples").insert(...)` then by default it is hitting the disk. I think that it's probably fine, but if you have multiple developers working on this project you probably want to make it into an official Django Middleware to adhere to standards of the Django project. If it's just a small one-off feature addition that I wouldn't worry too much about it. – dalanmiller Oct 20 '15 at 02:23