1

I am getting this error when i try to applying migrations using python manage.py migrate. I am using sqlite3. My model has a JSONField in it. Kindly any ideas how to fix this. Below is a snippet of the whole exception.

Operations to perform:
  Apply all migrations: account, admin, auth, blog, contenttypes, sessions, sites, small_small_hr, socialaccount
Running migrations:
  Applying small_small_hr.0011_auto_20200124_1128...Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\base.py", line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\core\management\commands\migrate.py", line 234, in handle
    fake_initial=fake_initial,
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\migrations\executor.py", line 245, in apply_migration
    state = migration.apply(state, schema_editor)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\migrations\migration.py", line 124, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\migrations\operations\fields.py", line 112, in database_forwards
    field,
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\backends\sqlite3\schema.py", line 327, in add_field
    self._remake_table(model, create_field=field)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\backends\sqlite3\schema.py", line 188, in _remake_table
    self.effective_default(create_field)
  File "C:\Users\hp\Anaconda3\lib\site-packages\django\db\backends\sqlite3\schema.py", line 64, in quote_value
    raise ValueError("Cannot quote parameter value %r of type %s" % (value, type(value)))
ValueError: Cannot quote parameter value <django.contrib.postgres.fields.jsonb.JsonAdapter object at 0x00000207F3896708> of type <class 'django.contrib.postgres.fields.jsonb.JsonAdapter'>

1 Answer 1

3

Ooops! I figured am using Postgres Specific JSONField which isnt supported in SQlite. Unlike PostgreSQL, JSON is not natively supported in SQLite. More info can be viewed here: https://medium.com/@philamersune/using-postgresql-jsonfield-in-sqlite-95ad4ad2e5f1

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.