[Django] #33103: I want to get the SQL through the model

1 view
Skip to first unread message

Django

unread,
Sep 11, 2021, 3:15:46 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: tufbel | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 3.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a Student Model:

{{{
class Student(models.Model):
stu_name = models.CharField(max_length=6, unique=True)
}}}

In the views, I want the SQL to create the student table in the database.

--
Ticket URL: <https://code.djangoproject.com/ticket/33103>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 11, 2021, 3:44:09 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: tufbel | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Abhijith Ganesh):

* status: new => closed
* resolution: => fixed


Comment:

use commands:
manage.py makemigrations
manage.py migrate
manage.py sqlmigrate model <migration number>
manage.py showmigrations

--
Ticket URL: <https://code.djangoproject.com/ticket/33103#comment:1>

Django

unread,
Sep 11, 2021, 3:44:51 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: tufbel | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: Closed | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Abhijith Ganesh):

* keywords: => Closed


--
Ticket URL: <https://code.djangoproject.com/ticket/33103#comment:2>

Django

unread,
Sep 11, 2021, 3:45:47 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: tufbel | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: Closed | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Abhijith Ganesh):

Use ORM to get the SQL

--
Ticket URL: <https://code.djangoproject.com/ticket/33103#comment:3>

Django

unread,
Sep 11, 2021, 9:21:52 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: Tuffy | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: invalid

Keywords: Closed | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* resolution: fixed => invalid


Comment:

See TicketClosingReasons/UseSupportChannels for ways to get help with
Django usage.

--
Ticket URL: <https://code.djangoproject.com/ticket/33103#comment:4>

Django

unread,
Sep 11, 2021, 9:57:26 AM9/11/21
to django-...@googlegroups.com
#33103: I want to get the SQL through the model
-------------------------------------+-------------------------------------
Reporter: Tuffy | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed


--
Ticket URL: <https://code.djangoproject.com/ticket/33103#comment:5>

Reply all
Reply to author
Forward
0 new messages