Modify

Ticket #219 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Problem renaming fields with sqlite.

Reported by: mwrshl@… Owned by: andrew
Priority: minor Milestone: 0.6
Component: databaseapi Version: 0.6-pre
Keywords: Cc:

Description

Using 46e95399bdca, I get this exception when renaming fields:

  File "/home/mmarshall/pythonpath/south/db/sqlite3.py", line 76, in copy_data
    q_fields[q_fields.index(value)] = "%s AS %s" % (qn(key), qn(value))
ValueError: list.index(x): x not in list

The problem is that names in q_fields are quoted quoted, while 'value' isn't. A simply change fixes this:

--- a/south/db/sqlite3.py	Mon Jul 27 14:38:41 2009 +0100
+++ b/south/db/sqlite3.py	Tue Jul 28 14:59:55 2009 -0500
@@ -72,6 +72,6 @@
         qn = connection.ops.quote_name
         q_fields = [qn(field) for field in fields]
         for key, value in field_renames.items():
-            q_fields[q_fields.index(value)] = "%s AS %s" % (qn(key), qn(value))
+            q_fields[q_fields.index(qn(value))] = "%s AS %s" % (qn(key), qn(value))
         sql = "INSERT INTO %s SELECT %s FROM %s;" % (qn(dst), ', '.join(q_fields), qn(src))
         self.execute(sql)

Attachments

Change History

comment:1 Changed 5 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 0.6

Fixed in [8e3ad05f8009].

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.