Hello Peter, That looks like https://code.djangoproject.com/ticket/24424
Simon Le lundi 14 novembre 2016 12:06:41 UTC-5, Peter Sels a écrit : > > Dear Django-ers, > > I ran into a problem with Django. > > -- > Situation: > -- > > I am using version 1.10.3 of Django. > > For the fifth time I updated my table related classes in models.py. > The 4 previous time this ran well all through > > (1) The server ran and did not complain about syntax errors or anything > else. > and > (2) $ python3 manage.py makemigrations > > but in > > (3) $ python3 manage.py migrate > I get the problem mentioned below when running > > The log of (2) and (3) is given below. > > -- > Questions: > -- > Any tips on how to solve it? > > How can I relate this to my own code in models.py? > > Do I really need to revert back to my previously (checked in) version of > models.py? > And then do small incremental steps again? > Or is there a better way? > (Unluckily I cannot share the models.py file.) > > thanks and best regards, > > Peter > > ------------ > > (2) > > *$ python3 manage.py makemigrations* > > *Migrations for 'market':* > > *market/migrations/0006_auto_20161114_1741.py*: > > - Alter field code on bidstate > > - Alter field code on coordinationschemevariant > > - Alter field code on networktype > > - Alter field code on segmenttype > > Herettix:SmartNet peter$ > > > > (3) > > *Herettix:SmartNet peter$ python3 manage.py makemigrations* > > Did you rename the market.SegmentType model to SegmentSlope? [y/N] y > > Did you rename qbiddataarray.segmentType to qbiddataarray.segmentSlope (a > ForeignKey)? [y/N] y > > *Migrations for 'market':* > > *market/migrations/0007_auto_20161114_1742.py*: > > - Rename model SegmentType to SegmentSlope > > - Rename field segmentType on qbiddataarray to segmentSlope > > Herettix:SmartNet peter$ > > Herettix:SmartNet peter$ > > Herettix:SmartNet peter$ python3 manage.py migrate > > *Operations to perform:* > > * Apply all migrations: *admin, auth, contenttypes, market, sessions > > *Running migrations:* > > Applying market.0005_auto_20161114_1254...Traceback (most recent call > last): > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line > 64, in execute > > return self.cursor.execute(sql, params) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", > line 337, in execute > > return Database.Cursor.execute(self, query, params) > > sqlite3.OperationalError: near ")": syntax error > > > The above exception was the direct cause of the following exception: > > > Traceback (most recent call last): > > File "manage.py", line 22, in <module> > > execute_from_command_line(sys.argv) > > File > "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", > line 367, in execute_from_command_line > > utility.execute() > > File > "/usr/local/lib/python3.4/site-packages/django/core/management/__init__.py", > line 359, in execute > > self.fetch_command(subcommand).run_from_argv(self.argv) > > File > "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", > line 294, in run_from_argv > > self.execute(*args, **cmd_options) > > File > "/usr/local/lib/python3.4/site-packages/django/core/management/base.py", > line 345, in execute > > output = self.handle(*args, **options) > > File > "/usr/local/lib/python3.4/site-packages/django/core/management/commands/migrate.py", > > line 204, in handle > > fake_initial=fake_initial, > > File > "/usr/local/lib/python3.4/site-packages/django/db/migrations/executor.py", > line 115, in migrate > > state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, > fake_initial=fake_initial) > > File > "/usr/local/lib/python3.4/site-packages/django/db/migrations/executor.py", > line 145, in _migrate_all_forwards > > state = self.apply_migration(state, migration, fake=fake, > fake_initial=fake_initial) > > File > "/usr/local/lib/python3.4/site-packages/django/db/migrations/executor.py", > line 244, in apply_migration > > state = migration.apply(state, schema_editor) > > File > "/usr/local/lib/python3.4/site-packages/django/db/migrations/migration.py", > line 129, in apply > > operation.database_forwards(self.app_label, schema_editor, old_state, > project_state) > > File > "/usr/local/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", > > line 147, in database_forwards > > schema_editor.remove_field(from_model, from_model._meta.get_field( > self.name)) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/schema.py", > > line 249, in remove_field > > self._remake_table(model, delete_fields=[field]) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/schema.py", > > line 199, in _remake_table > > self.quote_name(model._meta.db_table), > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/base/schema.py", > line 112, in execute > > cursor.execute(sql, params) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line > 79, in execute > > return super(CursorDebugWrapper, self).execute(sql, params) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line > 64, in execute > > return self.cursor.execute(sql, params) > > File "/usr/local/lib/python3.4/site-packages/django/db/utils.py", line > 94, in __exit__ > > six.reraise(dj_exc_type, dj_exc_value, traceback) > > File "/usr/local/lib/python3.4/site-packages/django/utils/six.py", line > 685, in reraise > > raise value.with_traceback(tb) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/utils.py", line > 64, in execute > > return self.cursor.execute(sql, params) > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", > line 337, in execute > > return Database.Cursor.execute(self, query, params) > > django.db.utils.OperationalError: near ")": syntax error > > Herettix:SmartNet peter$ > > > > The line 337 of > > File > "/usr/local/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py" > > is the return statement on the last line below: > > > class SQLiteCursorWrapper(Database.Cursor): > > """ > > Django uses "format" style placeholders, but pysqlite2 uses "qmark" > style. > > This fixes it -- but note that if you want to use a literal "%s" in a > query, > > you'll need to use "%%s". > > """ > > def execute(self, query, params=None): > > if params is None: > > return Database.Cursor.execute(self, query) > > query = self.convert_query(query) > > return Database.Cursor.execute(self, query, params) > > > > > > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ce92e431-d2bf-4208-a686-1a7449488914%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

