Opened 7 years ago

Closed 7 years ago

#28503 closed Bug (invalid)

Updating 1.10 to 1.11 object has no attribute 'select_for_update_skip_locked'

Reported by: Jorge Cadena Argote Owned by: nobody
Component: Uncategorized Version: 1.11
Severity: Normal Keywords: update version
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I upgrade from version 1.10.7 to 1.11.4 and I get the following error.

AttributeError: 'Query' object has no attribute 'select_for_update_skip_locked'

(env) aztrock@debian:~/workspace/env/kibox$ python manage.py runserver
Performing system checks...

/home/aztrock/workspace/env/local/lib/python3.5/site-packages/redis_cache/serializers.py:42: RuntimeWarning: Pickled model instance's Django version 1.10.6 does not match the current version 1.11.4.
  return pickle.loads(force_bytes(value))
/home/aztrock/workspace/env/local/lib/python3.5/site-packages/redis_cache/serializers.py:42: RuntimeWarning: Pickled queryset instance's Django version 1.10.6 does not match the current version 1.11.4.
  return pickle.loads(force_bytes(value))
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f230b7bed90>
Traceback (most recent call last):
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/channels/management/commands/runserver.py", line 54, in inner_run
    self.check(display_num_errors=True)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/aztrock/workspace/env/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/home/aztrock/workspace/env/kibox/billing/urls.py", line 9, in <module>
    from app.usuarios import views as UserViews
  File "/home/aztrock/workspace/env/kibox/app/usuarios/views.py", line 31, in <module>
    from .form import (
  File "/home/aztrock/workspace/env/kibox/app/usuarios/form.py", line 102, in <module>
    class ProfileUserForm(forms.ModelForm):
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/forms/models.py", line 261, in __new__
    apply_limit_choices_to=False,
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/forms/models.py", line 177, in fields_for_model
    formfield = f.formfield(**kwargs)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/db/models/fields/related.py", line 981, in formfield
    'queryset': self.remote_field.model._default_manager.using(db),
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/db/models/query.py", line 1034, in using
    clone = self._clone()
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/db/models/query.py", line 1103, in _clone
    query = self.query.clone()
  File "/home/aztrock/workspace/env/local/lib/python3.5/site-packages/django/db/models/sql/query.py", line 297, in clone
    obj.select_for_update_skip_locked = self.select_for_update_skip_locked
AttributeError: 'Query' object has no attribute 'select_for_update_skip_locked'

Change History (1)

comment:1 by Simon Charette, 7 years ago

Resolution: invalid
Status: newclosed

As pointed at by the warnings you tried re-using pickled QuerySets between Django versions

/home/aztrock/workspace/env/local/lib/python3.5/site-packages/redis_cache/serializers.py:42: RuntimeWarning: Pickled model instance's Django version 1.10.6 does not match the current version 1.11.4.
  return pickle.loads(force_bytes(value))
/home/aztrock/workspace/env/local/lib/python3.5/site-packages/redis_cache/serializers.py:42: RuntimeWarning: Pickled queryset instance's Django version 1.10.6 does not match the current version 1.11.4.
  return pickle.loads(force_bytes(value))

From https://docs.djangoproject.com/en/1.11/ref/models/querysets/#pickling-querysets

You can’t share pickles between versions

Pickles of QuerySets are only valid for the version of Django that was used to generate them. If you generate a pickle using Django version N, there is no guarantee that pickle will be readable with Django version N+1. Pickles should not be used as part of a long-term archival strategy.

Since pickle compatibility errors can be difficult to diagnose, such as silently corrupted objects, a RuntimeWarning is raised when you try to unpickle a queryset in a Django version that is different than the one in which it was pickled.

Note: See TracTickets for help on using tickets.
Back to Top