Rename tables in SQLite

Mon 28 January 2008 by Thejaswi Puthraya

Rename tables easily in SQLite

Django-Tagging recently moved to version 0.2 and introduced certain backward-incompatible changes. Due to these changes the tagging support for my blog had broken. The remedy as per the wiki was renaming the tables:

  • tag to tagging_tag
  • tagged_item to tagging_taggeditem

SQLite does not have a rename command, so here is what I did to rename the tables.

alter table tag rename to tagging_tag;
alter table tagged_item rename to tagging_taggeditem;

The other change was to change the keyword argument for a generic view tagged_object_list from model to queryset_or_model.

A special thanks to Jonathan Buchanan for the great tagging library. Tagging Support back into action!!!