[GH-ISSUE #264] After migration to 1.7.0 prunepings does not work... #197

Closed
opened 2026-02-25 23:41:33 +03:00 by kerem · 1 comment
Owner

Originally created by @stevenmcastano on GitHub (Jun 23, 2019).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/264

When I run at ./manage.py prunepings I get:

root@06c5858bc2d7:/opt/healthchecks>./manage.py prunepings
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1522, in transform
    return self.try_transform(wrapped, name)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1151, in try_transform
    "permitted%s" % (name, output_field.__name__, suggestion)
django.core.exceptions.FieldError: Unsupported lookup 'user' for AutoField or join on the field not permitted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/opt/healthchecks/hc/api/management/commands/prunepings.py", line 17, in handle
    q = q.annotate(limit=F("owner__user__profile__ping_log_limit"))
  File "/usr/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/django/db/models/query.py", line 1056, in annotate
    clone.query.add_annotation(annotation, alias, is_summary=False)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1000, in add_annotation
    summarize=is_summary)
  File "/usr/lib/python3.7/site-packages/django/db/models/expressions.py", line 511, in resolve_expression
    return query.resolve_ref(self.name, allow_joins, reuse, summarize, simple_col)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1610, in resolve_ref
    join_info.transform_function(targets[0], final_alias)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform
    raise last_field_exception
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1521, in transform
    wrapped = previous(field, alias)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform
    raise last_field_exception
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1521, in transform
    wrapped = previous(field, alias)
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform
    raise last_field_exception
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1504, in setup_joins
    names[:pivot], opts, allow_many, fail_on_missing=True,
  File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1420, in names_to_path
    "Choices are: %s" % (name, ", ".join(available)))
django.core.exceptions.FieldError: Cannot resolve keyword 'user' into field. Choices are: alert_after, channel, code, created, desc, flip, grace, has_confirmation_link, id, kind, last_ping, last_ping_was_fail, last_start, n_pings, name, notification, ping, project, project_id, schedule, status, subject, tags, timeout, tz
Originally created by @stevenmcastano on GitHub (Jun 23, 2019). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/264 When I run at `./manage.py prunepings` I get: ``` root@06c5858bc2d7:/opt/healthchecks>./manage.py prunepings Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1522, in transform return self.try_transform(wrapped, name) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1151, in try_transform "permitted%s" % (name, output_field.__name__, suggestion) django.core.exceptions.FieldError: Unsupported lookup 'user' for AutoField or join on the field not permitted. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, **cmd_options) File "/usr/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, **options) File "/opt/healthchecks/hc/api/management/commands/prunepings.py", line 17, in handle q = q.annotate(limit=F("owner__user__profile__ping_log_limit")) File "/usr/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/lib/python3.7/site-packages/django/db/models/query.py", line 1056, in annotate clone.query.add_annotation(annotation, alias, is_summary=False) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1000, in add_annotation summarize=is_summary) File "/usr/lib/python3.7/site-packages/django/db/models/expressions.py", line 511, in resolve_expression return query.resolve_ref(self.name, allow_joins, reuse, summarize, simple_col) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1610, in resolve_ref join_info.transform_function(targets[0], final_alias) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform raise last_field_exception File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1521, in transform wrapped = previous(field, alias) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform raise last_field_exception File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1521, in transform wrapped = previous(field, alias) File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1526, in transform raise last_field_exception File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1504, in setup_joins names[:pivot], opts, allow_many, fail_on_missing=True, File "/usr/lib/python3.7/site-packages/django/db/models/sql/query.py", line 1420, in names_to_path "Choices are: %s" % (name, ", ".join(available))) django.core.exceptions.FieldError: Cannot resolve keyword 'user' into field. Choices are: alert_after, channel, code, created, desc, flip, grace, has_confirmation_link, id, kind, last_ping, last_ping_was_fail, last_start, n_pings, name, notification, ping, project, project_id, schedule, status, subject, tags, timeout, tz ```
kerem closed this issue 2026-02-25 23:41:33 +03:00
Author
Owner

@cuu508 commented on GitHub (Jun 24, 2019):

Thanks for the report! I broke this when adding the Projects feature. The new database schema required small code changes all over the codebase. Somehow missed the prunepings and prunepingsslow management commands.

Now fixed, add added tests. The tests also found a harmless off-by-one error, fixed that one as well...

<!-- gh-comment-id:505051511 --> @cuu508 commented on GitHub (Jun 24, 2019): Thanks for the report! I broke this when adding the Projects feature. The new database schema required small code changes all over the codebase. Somehow missed the `prunepings` and `prunepingsslow` management commands. Now fixed, add added tests. The tests also found a harmless off-by-one error, fixed that one as well...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#197
No description provided.