[Django] #32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL operations

11 views
Skip to first unread message

Django

unread,
Apr 26, 2021, 7:47:50 AM4/26/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
------------------------------------------------+--------------------------
Reporter: Hannes Ljungberg | Owner: nobody
Type: Cleanup/optimization | Status: assigned
Component: Migrations | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+--------------------------
For example:
{{{
migrations.RunSQL(
"""
INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1);
""",
migrations.RunPython.noop
)
}}}

Will output:
{{{

INSERT INTO test_runsql_pony (pink, weight) VALUES (1, 1);
;
}}}

As in:
{{{
'\n INSERT INTO test_runsql_pony (pink, weight) VALUES (1,
1);\n ;'
}}}

We should at least not output the extra semicolon but one thought could be
to run `str.strip()` on the SQL string to drop the leading/trailing
whitespace making it a bit nicer to read.

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

Django

unread,
Apr 26, 2021, 7:56:43 AM4/26/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------

Reporter: Hannes Ljungberg | Owner: nobody
Type: | Status: assigned
Cleanup/optimization |
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

PR: https://github.com/django/django/pull/14314

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

Django

unread,
Apr 26, 2021, 7:59:21 AM4/26/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------
Reporter: Hannes Ljungberg | Owner: Hannes
Type: | Ljungberg

Cleanup/optimization | Status: assigned
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

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

* owner: nobody => Hannes Ljungberg


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

Django

unread,
Apr 26, 2021, 8:58:10 AM4/26/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------
Reporter: Hannes Ljungberg | Owner: Hannes
Type: | Ljungberg
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* stage: Unreviewed => Accepted


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

Django

unread,
Apr 26, 2021, 9:39:27 AM4/26/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------
Reporter: Hannes Ljungberg | Owner: Hannes
Type: | Ljungberg
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

* stage: Accepted => Ready for checkin


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

Django

unread,
Apr 27, 2021, 2:35:45 AM4/27/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------
Reporter: Hannes Ljungberg | Owner: Hannes
Type: | Ljungberg
Cleanup/optimization | Status: assigned
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

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

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"95754dbc9b9479787e422f32b028493a4d2a6ec1" 95754db]:
{{{
#!CommitTicketReference repository=""
revision="95754dbc9b9479787e422f32b028493a4d2a6ec1"
Refs #32686 -- Added tests for adding a semicolon when collecting SQL for
RunSQL.
}}}

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

Django

unread,
Apr 27, 2021, 2:35:45 AM4/27/21
to django-...@googlegroups.com
#32686: Extraneous semicolon displayed on sqlmigrate for multiline RunSQL
operations
-------------------------------------+-------------------------------------
Reporter: Hannes Ljungberg | Owner: Hannes
Type: | Ljungberg
Cleanup/optimization | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: fixed

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

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

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


Comment:

In [changeset:"eab71f7690c523b25b867a9cd5bf6fb82a33c6b4" eab71f76]:
{{{
#!CommitTicketReference repository=""
revision="eab71f7690c523b25b867a9cd5bf6fb82a33c6b4"
Fixed #32686 -- Removed unnecessary semicolon on collected multiline SQL
for RunSQL.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32686#comment:6>

Reply all
Reply to author
Forward
0 new messages