Can we use Database with Django without creating models

29 views
Skip to first unread message

Mayank Tripathi

unread,
May 25, 2020, 8:27:30 PM5/25/20
to Django users
Hi Team,

I am trying to get options to connect to Database from Python-Django App.
But here the requirement is I already have a Database setup (MySQL) with all required tables and fields.
So am not willing to use models.py and create tables.
Is there a way still i can use the tables... and still be able to do similar query which is done using ORM (i mean Django default querysets).

Please suggest.

_M_A_Y_A_N_K_

unread,
May 25, 2020, 10:50:02 PM5/25/20
to django...@googlegroups.com
Adding more details...
I did tried inspectdb, but having other different issues with this. Here i want to purely use the legacy / existing database.

Thanks & Regards,
---------------------
Mayank Tripathi
Mo. +1 615 962 2128
"Do what you can, with what you have, where you are -by Theodore Roosevelt"


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ea4fdb96-0462-40ad-aec1-6bf1318cb0fd%40googlegroups.com.

Dylan Reinhold

unread,
May 25, 2020, 11:42:07 PM5/25/20
to django...@googlegroups.com
Inspectdb is the way to go.
Nothing is stopping you from just running sql queries though your DB python package like mysql-connector. 
You will loose much of the extras django provides with using the django-orm like admin connections to your database.

Maybe flask would suit your use case better?

Dylan



Reply all
Reply to author
Forward
0 new messages