JsonField in Django for MySQL - django

I currently use django 3.2 and MySQL as database, I want use MySql Json Field. For this reason use django-mysql third party package in my project.
After create model got this Warning: (django_mysql.W004) django_mysql.models.JSONField is deprecated. HINT: Use django.db.models.JSONField or django-jsonfield-backport instead.
If i use django.db.models.JSONField as json field, django use specific MySQL's JsonField ? Dose any effect on preformance? Which one has best performance on database?

The documentation here, does not mention a difference in performance. So, probably there is none. It looks like the change is only for supporting all databases with the same unique model field. There is a similar issue in this link. So, you can check that, too. As I read, django-jsonfield-backport is for early versions of Django. So, choose according to your version.

Related

How to design database for fields like google forms?

I want to build forms and models with dynamic fields like Google Form. But I don't know what type of model.Fields use for this task.
I using Postgres and I thinking about something like Hstore or ArrayField, but I'm not sure.
What is the best solution for this?
There are few solutions available for your task:
EAV (Entity-Attribute-Value) model with django-eav package.
Postgresql HSTORE field but it supports only string type of values.
Postgresql JSON field.
If you use modern PostgreSQL version (9.3+) you should use PostgreSQL JSON fields because JSON supports different data types.

What functionality is lost when using django with mongodb?

I am evaluating whether I want to use mongoDB with django for my next project. What I am not sure about, though, is what functionality (ORM, admin, forms, etc.) I loose when I use a DB backend that is not officially supported.
I consider using the mongodb-engine.
So, you have Django-mongoadmin and Django-mongonaut for django-admin stuff. Also
Django-mongodbforms for model forms. MongoEngine as ORM. But this modules are pretty raw and unstable so use it with wariness.

Django-nonrel vs Django-mongodb vs Mongokit vs pymongo native

Working on a Django project that requires a NoSQL store and I believe I've settled on Mongo. I've seen a lot of topics that talk about Mongo and Django, but none that mentioned Django-nonrel, and I can't see why it might have been disqualified, but I have no experience with any of them.
Ideally, I'd like to preserve the SQL store for the simple things, user auth, groups, etc., and use Mongo for the bigger data.
I'd also like to have my Mongo-stored objects as classes, in a Django-ORM style, so that I can have a similar 'feel', but that isn't critical.
Lastly, do any of the above allow me to use Django's multi-database support for anything, or are all my mongo queries effectively 'out of band' from the Django ORM?
If there are any other factors I'm missing that might be important, feel free to clue me in. I know little in this arena.
Django-nonrel is the way to go for Django on MongoDB. There's django-mongodb.org, but that's just built on top of Django-nonrel. There's quite a bit of mongodb activity going on the django-nonrel mailing list.
Storing your mongo classes as Django ORM objects works fine, that's the whole point.
I haven't tried using the multi-database support along with SQL. I haven't seen many people use it like that, and I suspect it most likely does not work. There's some work on moving django-nonrel to be officially part of Django 1.4, I suspect it'll work after that's complete.
Using django-nonrel for auth works ok. The main problem is many-to-many relations. The auth module uses that for per user object permissions - that doesn't work. If you don't need that, you could probably get away without using the SQL at all.
Adding onto dragonx answer. The issue with django-nonrel is that the auth module doesn't work.
You can perform many-to-mamy joins using $lookup operator. djongo does automatically for you. It translates SQL syntax into mongodb aggregation queries and populates the object model, like other SQL drivers.
The auth module works fine on djongo

Django - It is possible to use Haystack with custom SQL directly

I'm in the process of choosing a Framework for a new project. I have basically the database schema developed(I have this schema running in other PHP webapps already).
In this project I will need to basically search the database schema with Solr. The database schema is a little bit complex to define models in Django, so I think the only option I have is to execute SQL directly... my doubt is about Haystack/Solr... It is possible to query Haystack/Solr when I have no Django Models defined?
PS: I'm new to Django, I have never userd Haystack.
Haystack is pretty tightly coupled to the Django ORM. If you're not using Django models, I don't think Haystack is suitable. I've only used Haystack briefly, so I might wrong.
From the Haystack docs:
When should I not be using Haystack?
Non-Model-based data. If you just want to index random data (flat files, alternate sources, etc.), Haystack isn’t a good solution. Haystack is very Model-based and doesn’t work well outside of that use case.
I never used haystack, but you can always perform raw sql queries.
Have a look on documentation:
https://docs.djangoproject.com/en/dev/topics/db/sql/#executing-custom-sql-directly

mongodb for django

I like mongodb and django,and there are some frameworks to select:
mongodbengine
django-mongodb-engine
Mongodbengine has good performance and django ORM like api,but when serialize ,it's not supported now.
Django-mongodb-engine is a django backend,you can use it with django ORM.
So django-mongodb-engine is better? and how about its performance?
There are a number of projects out there for incorporating MongoDB with Django but the best one (I believe) is yet to come. Alex Gaynor's Google Summer of Code project is working on a queryset refactor of the Django ORM to allow for non-relational backends. In his last update he stated that they have a working MongoDB backend:
Since this is about the halfway point
of GSOC I'll give a general overview:
we have a working MongoDB backend,
with many implemented features, and a
set of changes to Django itself (that
don't break anything else of course)
that enable this.
http://groups.google.com/group/django-developers/browse_thread/thread/36ed23d7b32ff0fd?pli=1
So if you want to use MongoDB with the Django ORM you can switch to django-norel and use django-mongodb-engine or you can wait for Alex's work to be merged into the trunk.
We use django-mongodb-engine in production and we haven't face any performance issues. It is well known that using django-mongodb-engine means that you'll be tight to the django ORM, checks, fields and so on. But, you're also able to execute raw queries when you simply don't care about django ORM.
django-mongodb-engine started taking some ideas from opensource projects (mongodbengine is one of those)
P.S: One of the things I like more about django-mongodb is the easy integration with django because it allow you to simply switch the DB when you need it (Unless you're using "non-standard fields")
P.S2: I'll open a issue requesting some benchmarks
Update: The issue link