[Django] #24071: Error with sqlmigrate

8 views
Skip to first unread message

Django

unread,
Jan 2, 2015, 2:25:54 PM1/2/15
to django-...@googlegroups.com
#24071: Error with sqlmigrate
----------------------------+--------------------
Reporter: djbug | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
I have an app where I create a simple table and then add a partial index
directly in SQL using RunSQL & migrations. I get an error with
`sqlmigrate` when I use it on a custom migration.

The command is : `manage.py sqlmigrate myapp 0002_custom.py`

0002_custom.py files looks like this:

{{{
class Migration(migrations.Migration):

dependencies = [
('myapp', '0001_initial'),
]

operations = [
migrations.RunSQL(
sql = 'CREATE UNIQUE INDEX test_idx ON book (name,
publisher_id) WHERE publisher_id IS NOT NULL;',
)
]

}}}

Here's the error:

{{{
(django1_7) C:\djangoproject>python manage.py sqlmigrate myapp 0002

Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\commands\sqlmigrate.py", line 30, in
execute
return super(Command, self).execute(*args, **options)
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\base.py", line 338, in execute
output = self.handle(*args, **options)
File "C:\virtualenv\django1_7\lib\site-
packages\django\core\management\commands\sqlmigrate.py", line 61, in
handle
sql_statements = executor.collect_sql(plan)
File "C:\virtualenv\django1_7\lib\site-
packages\django\db\migrations\executor.py", line 77, in collect_sql
migration.apply(project_state, schema_editor, collect_sql=True)
File "C:\virtualenv\django1_7\lib\site-
packages\django\db\migrations\migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor,
project_state, new_state)
File "C:\virtualenv\django1_7\lib\site-
packages\django\db\migrations\operations\special.py", line 69, in
database_forwards
schema_editor.execute(statement, params=None)
File "C:\virtualenv\django1_7\lib\site-
packages\django\db\backends\schema.py", line 96, in execute
self.collected_sql.append((sql % tuple(map(self.quote_value, params)))
+ ";")
TypeError: argument 2 to map() must support iteration

}}}

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

Django

unread,
Jan 2, 2015, 3:55:18 PM1/2/15
to django-...@googlegroups.com
#24071: Error with sqlmigrate
----------------------------+--------------------------------------
Reporter: djbug | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: duplicate
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 claudep):

* status: new => closed
* needs_better_patch: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_docs: => 0


Comment:

Duplicate of #23909 (should be fixed very soon in 1.7.2)

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

Reply all
Reply to author
Forward
0 new messages