Opened 3 years ago

Closed 3 years ago

#32686 closed Cleanup/optimization (fixed)

Extraneous semicolon displayed on sqlmigrate for multiline RunSQL operations

Reported by: Hannes Ljungberg Owned by: Hannes Ljungberg
Component: Migrations Version: 3.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (6)

comment:1 by Hannes Ljungberg, 3 years ago

Has patch: set

comment:2 by Hannes Ljungberg, 3 years ago

Owner: changed from nobody to Hannes Ljungberg

comment:3 by Nick Pope, 3 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Nick Pope, 3 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

In 95754db:

Refs #32686 -- Added tests for adding a semicolon when collecting SQL for RunSQL.

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In eab71f76:

Fixed #32686 -- Removed unnecessary semicolon on collected multiline SQL for RunSQL.

Note: See TracTickets for help on using tickets.
Back to Top