Can I use Firestore with django python being firestore a non-relational database? if it is not the case, Django-non-rel is the option?
I had the same question and found a library called django-firebase-orm. I assume it'll map Django's relational model onto firestore.
Related
Can I store a Django model in an ElasticSearch index?
If yes, then how can I do that?
The question is really generic question and I don't know you checked the following pages or not. Here are some resources for you to check how you can do it :
[Github] Django Elasticsearch DSL is a package that allows indexing of django models in elasticsearch. https://github.com/django-es/django-elasticsearch-dsl
[Article] How to Use ElasticSearch With Django - https://medium.com/geekculture/how-to-use-elasticsearch-with-django-ff49fe02b58d
[Article] How to use Elasticsearch with Django https://sunscrapers.com/blog/how-to-use-elasticsearch-with-django/
I am working on already existing data on relational database. Now question is that how to build models and how to update the tables with new data coming from user (technically django forms)?
Django natively supports creating models for and working with existing data. From the documentation:
Integrating Django with a legacy database
Django will still need to create several of its own tables, but will adapt to use your existing tables. From the doc, you can auto-create models like this:
python manage.py inspectdb > models.py
You'll need to determine whether you want to manage updates to the table structure, but that's getting into details that will be specific to your project.
Like in phpmyadmin, we have an visual interface to manage fields. Can we do the same thing in Django?
If your Django connected database is e.g. PostgreSQL, you could use pgAdmin4 (https://www.pgadmin.org/). So it is actually not about managing the tables in Django but in a database tool (visually). To manipulate your database schema you will have to use Models in your Django application (https://docs.djangoproject.com/en/2.2/topics/db/models/).
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.
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