[Django] #30444: Refactor `BaseDatabaseSchemaEditor.create_model`

7 views
Skip to first unread message

Django

unread,
May 5, 2019, 4:39:35 PM5/5/19
to django-...@googlegroups.com
#30444: Refactor `BaseDatabaseSchemaEditor.create_model`
-------------------------------------+-------------------------------------
Reporter: Rob | Owner: nobody
Golding |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: master
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've been working on a project that uses Citus as the database (which is a
Postgres database extension). I found it easy to override methods to
change most of the behaviour in the `BaseDatabaseSchemaEditor` class, but
the `create_model` functionality differs in that it directly executes SQL
which it generates itself.

I propose extracting this logic into a `table_sql` method, similar to how
`column_sql` works.

I'm happy to submit a PR for this work if it sounds like a reasonable
improvement!

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

Django

unread,
May 5, 2019, 10:04:20 PM5/5/19
to django-...@googlegroups.com
#30444: Refactor `BaseDatabaseSchemaEditor.create_model`
-------------------------------------+-------------------------------------
Reporter: Rob Golding | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* stage: Unreviewed => Accepted


Comment:

That sounds like a reasonable improvement.

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

Django

unread,
May 6, 2019, 12:53:37 PM5/6/19
to django-...@googlegroups.com
#30444: Refactor `BaseDatabaseSchemaEditor.create_model`
-------------------------------------+-------------------------------------
Reporter: Rob Golding | Owner: nobody
Type: | Status: new
Cleanup/optimization |

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 0 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
May 7, 2019, 4:49:31 AM5/7/19
to django-...@googlegroups.com
#30444: Refactor `BaseDatabaseSchemaEditor.create_model`
-------------------------------------+-------------------------------------

Reporter: Rob Golding | Owner: nobody
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

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


Comment:

In [changeset:"4043dc69cd41d100f201e4c71b1515db341fbd45" 4043dc69]:
{{{
#!CommitTicketReference repository=""
revision="4043dc69cd41d100f201e4c71b1515db341fbd45"
Fixed #30444 -- Moved SQL generation for tables to
BaseDatabaseSchemaEditor.table_sql().
}}}

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

Reply all
Reply to author
Forward
0 new messages