django-ipgeobase icon indicating copy to clipboard operation
django-ipgeobase copied to clipboard

Got 'Invalid syntax' error on MySQL when doing ipgeobase_update

Open yeputons opened this issue 12 years ago • 1 comments

I use Django (python 2.7) with MySQL on linux, and when I try to run ./manage.py ipgeobase_update I get DatabaseError 1064: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"start_ip", "end_ip", ip_block, country, city, region, district, latitude, longi' at line 2'. Removing of quotes around 'start_ip' and 'end_ip' fixes the problem. Because there're no quotes around other fields' names, I think that this won't break compatibility with other servers.

yeputons avatar Jan 01 '12 11:01 yeputons

I fixed 'Invalid syntax' error by commands for MySQL console:

ALTER TABLE django_ipgeobase_ipgeobase MODIFY city VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci; ALTER TABLE django_ipgeobase_ipgeobase MODIFY region VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci; ALTER TABLE django_ipgeobase_ipgeobase MODIFY district VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci;

vladvlasov256 avatar Jul 21 '12 19:07 vladvlasov256