question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OperationalError: too many SQL variables

See original GitHub issue

Summary

Happens in VM and my local dev repo, where I have imported CK-12 channel from USB drive. Channel isn’t showing as Featured in... in Recommended tab with the below errors in the console, but its content can be browsed correctly in Topics.

fullscreen_10_10_17_03_59

fullscreen_10_10_17_03_54

System information

  • Version: latest develop
  • Operating system: Win VM and develop on OSX
  • Browser: all

Traceback or relevant snippet from server.log or browser console

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/api/contentnode/all_content/?channel_id=1d8f6d84618153c18c695d85074952a7&1507745570490=1507745570490

Django Version: 1.9.7
Python Version: 2.7.14
Installed Applications:
[u'kolibri.core',
 u'django.contrib.admin',
 u'django.contrib.auth',
 u'django.contrib.contenttypes',
 u'django.contrib.sessions',
 u'django.contrib.messages',
 u'django.contrib.staticfiles',
 u'kolibri.auth.apps.KolibriAuthConfig',
 u'kolibri.content',
 u'kolibri.logger',
 u'kolibri.tasks.apps.KolibriTasksConfig',
 u'kolibri.core.webpack',
 u'kolibri.core.exams',
 u'kolibri.core.device',
 u'kolibri.core.discovery',
 u'rest_framework',
 u'django_js_reverse',
 u'jsonfield',
 u'morango',
 u'kolibri.plugins.management',
 u'kolibri.plugins.learn',
 u'kolibri.plugins.document_pdf_render',
 u'kolibri.plugins.html5_app_renderer',
 u'kolibri.plugins.media_player',
 u'kolibri.plugins.setup_wizard',
 u'kolibri.plugins.coach',
 u'kolibri.plugins.user',
 u'kolibri.plugins.style_guide',
 u'kolibri_exercise_perseus_plugin']
Installed Middleware:
(u'django.contrib.sessions.middleware.SessionMiddleware',
 u'kolibri.core.device.middleware.KolibriLocaleMiddleware',
 u'django.middleware.common.CommonMiddleware',
 u'django.middleware.csrf.CsrfViewMiddleware',
 u'kolibri.plugins.setup_wizard.middleware.SetupWizardMiddleware',
 u'kolibri.auth.middleware.CustomAuthenticationMiddleware',
 u'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 u'django.contrib.messages.middleware.MessageMiddleware',
 u'django.middleware.clickjacking.XFrameOptionsMiddleware',
 u'django.middleware.security.SecurityMiddleware')



Traceback:

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/rest_framework/viewsets.py" in view
  87.             return self.dispatch(request, *args, **kwargs)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  466.             response = self.handle_exception(exc)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  463.             response = handler(request, *args, **kwargs)

File "kolibri/content/api.py" in all_content
  280.         return Response(serializer.data)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/rest_framework/serializers.py" in data
  674.         ret = super(ListSerializer, self).data

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/rest_framework/serializers.py" in data
  239.                 self._data = self.to_representation(self.instance)

File "kolibri/content/serializers.py" in to_representation
  170.         if not data:

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in __nonzero__
  266.         return type(self).__bool__(self)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in __bool__
  262.         self._fetch_all()

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  1076.             self._prefetch_related_objects()

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in _prefetch_related_objects
  656.         prefetch_related_objects(self._result_cache, self._prefetch_related_lookups)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in prefetch_related_objects
  1457.                 obj_list, additional_lookups = prefetch_one_level(obj_list, prefetcher, lookup, level)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in prefetch_one_level
  1556.         prefetcher.get_prefetch_queryset(instances, lookup.get_current_queryset(level)))

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/fields/related_descriptors.py" in get_prefetch_queryset
  543.             for rel_obj in queryset:

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  258.         self._fetch_all()

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in _fetch_all
  1074.             self._result_cache = list(self.iterator())

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/query.py" in __iter__
  52.         results = compiler.execute_sql()

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  848.             cursor.execute(sql, params)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  95.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/Users/mac/.venvs/kolibri-sans2/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py" in execute
  323.         return Database.Cursor.execute(self, query, params)

Exception Type: OperationalError at /api/contentnode/all_content/
Exception Value: too many SQL variables

How to reproduce

  1. Download ZIP (beware, 6GB)
  2. Unzip and do a local import
  3. Go to Learn

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
rtibblescommented, Oct 11, 2017

The sign in error is unrelated (and not a bug, just always happens when you log in as a non learner to simplified login).

0reactions
rtibblescommented, Oct 12, 2017

Fixed in #2424

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Too many SQL variables" error in django with sqlite3
Exception Value: too many SQL variables. And I think the answer to it is this, from here: Many SQL programmers are familiar with...
Read more >
"too many SQL variables" Error with pandas 0.23 - enable ...
Now I receive this error "OperationalError: (sqlite3.OperationalError) too many SQL variables". I am converting a dataframe with ~20k+ rows ...
Read more >
SQLite can no longer handle more than 2000 values in a " ...
The former gives "too many SQL variables"; I assume the latter gives ... return cursor.execute(sql, params).fetchone() OperationalError: too many columns in ...
Read more >
DatabaseError: too many SQL variables
I'd first look at your design. Depending on the database being used you'll likely be hitting a limit on the width of a...
Read more >
SQlite3: too many SQL variables, Foreign Keys & Delete
[Django] #23713: SQlite3: too many SQL variables, Foreign Keys & Delete. Django. 8 years ago ... OperationalError: print(dbconnection.queries)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found