Can you remove a model's last field of SQLite3 in Django 1.8?

63 views
Skip to first unread message

KwangYoun Jung

unread,
Nov 29, 2015, 12:17:54 PM11/29/15
to Django users
Can you remove a model's last field of SQLite3 in Django 1.8?

I have a model that has only one column in SQLite3.
When I remove a last field of the model, I get an error like below

django.db.utils.OperationalError: near ")": syntax error

Anyone knows about this issue ?

Daniel Roseman

unread,
Nov 29, 2015, 2:29:50 PM11/29/15
to Django users
No, nobody knows anything about this issue because you didn't give any details. What does "remove a last field" mean? When are you getting that error? What code did you run?
--
DR. 

Markus Holtermann

unread,
Nov 29, 2015, 3:29:03 PM11/29/15
to django...@googlegroups.com
No, you can't because of two things:

1. SQLite doesn't allow an 'ALTER TABLE ... DROP COLUMN ...'

We get away with that by creating a new table and copying the data
over: https://www.sqlite.org/lang_altertable.html

2. SQLite doesn't allow a 'CREATE TABLE' statement without any columns:
https://www.sqlite.org/lang_createtable.html

/Markus

On Sun, Nov 29, 2015 at 09:17:53AM -0800, KwangYoun Jung wrote:
>Can you remove a model's last field of SQLite3 in Django 1.8?
>
>I have a model that has only one column in SQLite3.
>When I remove a last field of the model, I get an error like below
>
>
>
>*django.db.utils.OperationalError: near ")": syntax error*Anyone knows
>about this issue ?
>
>--
>You received this message because you are subscribed to the Google Groups "Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
>To post to this group, send email to django...@googlegroups.com.
>Visit this group at http://groups.google.com/group/django-users.
>To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/951e9cbd-2540-43eb-a951-6a3722f3ee3d%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages