Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgrammingError on postgresql #146

Closed
rafpaf opened this issue Oct 16, 2016 · 5 comments
Closed

ProgrammingError on postgresql #146

rafpaf opened this issue Oct 16, 2016 · 5 comments

Comments

@rafpaf
Copy link

rafpaf commented Oct 16, 2016

Silk works well in my development sqlite3 environment, but in my production environment, which uses postgresql, I get this error:

ProgrammingError at /silk/
column "silk_request.path" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "silk_request"."id", "silk_request"."path", "silk_req...

Traceback: http://dpaste.com/0WQDKXV

@rafpaf
Copy link
Author

rafpaf commented Oct 16, 2016

python version: 3.5.2
django version: 1.9.8
postgres version: 8.4.20
django-silk version: 0.7.1

@avelis
Copy link
Collaborator

avelis commented Oct 17, 2016

@rafpaf 0.7.1 has a known issue for not working with PostgresSQL. I haven't had a chance to pull it from PyPI. Either take the latest from master or use version 0.7.0

If it still persists in 0.7.0 then update me here on this ticket and I can look at the issue in more detail.

@avelis
Copy link
Collaborator

avelis commented Oct 17, 2016

Notes: Sanitized Stacktrace

Environment:


Request Method: GET
Request URL: http://test.com/silk/

Django Version: 1.9.8
Python Version: 3.5.2
Installed Applications:
['django_extensions',
 'powertrip',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'dbsettings',
 'silk']
Installed Middleware:
['silk.middleware.SilkyMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback:

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

The above exception (column "silk_request.path" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "silk_request"."id", "silk_request"."path", "silk_req...
                                    ^
) was the direct cause of the following exception:

File "/path/to/users/installation/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/path/to/users/installation/lib/python3.5/site-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/path/to/users/installation/lib/python3.5/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "/path/to/users/installation/lib/python3.5/site-packages/django/views/generic/base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "/path/to/users/installation/lib/python3.5/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/path/to/users/installation/lib/python3.5/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/path/to/users/installation/lib/python3.5/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/path/to/users/installation/lib/python3.5/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/path/to/users/installation/lib/python3.5/site-packages/silk/views/summary.py" in get
  83.         c = self._create_context(request)

File "/path/to/users/installation/lib/python3.5/site-packages/silk/views/summary.py" in _create_context
  73.             'most_time_spent_in_db': self._time_spent_in_db_by_view(filters),

File "/path/to/users/installation/lib/python3.5/site-packages/silk/views/summary.py" in _time_spent_in_db_by_view
  45.             r = models.Request.objects.filter(view_name=view, *filters).annotate(t=Sum('queries__time_taken')).order_by('-t')[0]

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/models/query.py" in __getitem__
  297.         return list(qs)[0]

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
  258.         self._fetch_all()

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
  1074.             self._result_cache = list(self.iterator())

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/models/query.py" in __iter__
  52.         results = compiler.execute_sql()

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
  848.             cursor.execute(sql, params)

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/utils.py" in __exit__
  95.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/path/to/users/installation/lib/python3.5/site-packages/django/utils/six.py" in reraise
  685.             raise value.with_traceback(tb)

File "/path/to/users/installation/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /silk/
Exception Value: column "silk_request.path" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT "silk_request"."id", "silk_request"."path", "silk_req...
                                    ^

@rafpaf
Copy link
Author

rafpaf commented Oct 17, 2016

Thank you, I'll give that a whirl.

@avelis
Copy link
Collaborator

avelis commented Dec 3, 2016

@rafpaf Should be fixed in release https://github.com/django-silk/silk/releases/tag/0.7.2

If the release does not fix this issue re-open.

@avelis avelis closed this as completed Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants