SQLAlchemy Postgresql database django - python

I am new to Django and have a question in regards to whether or not I have to re-enter data or can use existing data from a postgres database and apologize if this has been asked before.
I have a Postgres database in which I created with SQLAlchemy ORM. I use this database for data analysis and want to create a web app for the data presentation. I know that Django has its own modeling system and ORM, do I have to recreate the database from scratch since I created this with SQLAlchemy's ORM?

You can use inspectdb command from Django.
https://docs.djangoproject.com/en/4.0/howto/legacy-databases/

Related

How to connect to existing SQLite DB using tortoise ORM?

I have existing SQLite DB with large data in it. I want to query the data asynchronously using tortoise ORM. How do I connect the database and query the data?
There is not magical tool. The inspectdb option in Aerich works for mysql.
You can create your models and read data from old sqlite db by driver and insert into new database.
The bulk_create method can improve the process time.

How to change model and update database, make migrations, in flask-admin?

I already have my flask-admin app with its models and database and tables created..
Now I would like to add a field to model and that should be reflected in the database by a new column in the model's corresponding table.
With django one would create then apply migrations..
How do I make migrations/schema-changes in flask-admin?
I would recommend checking out the section on SQLAlchemy-based database migrations in Miguel Grinberg's Database Flask Mega-Tutorial. He uses low-level SQLAlchemy APIs to put the database under version control and automate the process of database version upgrades or downgrades.
Alternatively, I recommend using Miguel Grinberg's Flask-Migrate extension which implements the functionality he describes in the aforementioned tutorial. Using this extension, you simply add an instance of the Migrate object to your application, then perform database migrations using a command line interface provided by the extension.

Query a database in Django and not creating a db

Am I able to query a database I have in place with Django and not creating a database? I ask this question because all documentation I have read shows Django as creating a database. I do not want to create a DB, but use a DB I have in place in my Django apps. I have read through the Django docs, Google searches, and YouTube but I am unable to find anything further on not creating a DB and only using a DB I have in place.

How to migrate SQL data to NoSQL document?

I have a SQL database administrate with Django (web Framework). On this database, items are only update.
In other side, I have a NoSQL database (document-oriented). Sometimes, I need to migrate the SQL Data to NoSQL document forms and insert it on the NoSQL database.
I saw this question: Migrate data from relational DB to NoSQL
But the answer does not suit me.
And I saw Django-nonrel can help me to get a connector to a NoSQL database.
In my case, are there tools or any solutions more appropriate than create classes and methods in Python by myself for transform SQL data to NoSQL document?

Python restful API tools selection when DB tables already created

I used Django REST framework to write API, the Django ORM is really conveinent like DB migrate or relation field's query.
But now we have a case, there is a DB with about 30 tables with data in it. And we have to query the DB and write some API. So I think I can't use Django this time.
What develop tools do you recommand to write restful API in Python if your case have the database that already created tables in it?
You can use inspectdb command to create django models from existing database.
python manage.py inspectdb > models.py
Here is the docs: Integrating Django with a legacy database

Categories

Resources