[ckan-dev] Page view tracking issue

PIERRE Sylvain sylvain.pierre at bas-rhin.fr
Mon Sep 23 14:40:31 UTC 2019

Hi all,
Ckan 2.8.3
I get an error when passing paster command :
paster --plugin=ckan tracking update -c /etc/ckan/default/production.ini

Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 10, in <module>
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 1115, in command
    self.update_all(engine, start_date)
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 1149, in update_all
    self.update_tracking(engine, start_date)
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 1251, in update_tracking
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 2064, in execute
    return connection.execute(statement, *multiparams, **params)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 939, in execute
    return self._execute_text(object, multiparams, params)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1097, in _execute_text
    statement, parameters
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) ERREUR:  l'opérateur n'existe pas : timestamp without time zone - integer
LINE 12: ....tracking_date AND t2.tracking_date >= t1.tracking_date - 14
HINT:  Aucun opérateur ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
[SQL: "UPDATE tracking_summary t1\n                 SET running_total = (\n                    SELECT sum(count)\n                    FROM tracking_summary t2\n                    WHERE t1.url = t2.url\n                    AND t2.tracking_date <= t1.tracking_date\n                 )\n                 ,recent_views = (\n                    SELECT sum(count)\n                    FROM tracking_summary t2\n                    WHERE t1.url = t2.url\n                    AND t2.tracking_date <= t1.tracking_date AND t2.tracking_date >= t1.tracking_date - 14\n                 )\n                 WHERE t1.running_total = 0 AND tracking_type = 'resource';"]

It sounds like a sql wrong formating string in "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 1251, code perform substraction on a timestamp field.

First question : should it be fix?
Second: is page view tracking function in use (realy) on ckan production sites?


→  Sylvain PIERRE
         Chef de projet système d’information
         Direction des Systèmes d’Information
         Service Projets et Applications Numériques
       Conseil Départemental du Bas-Rhin

[cid:image003.jpg at 01D5722D.9CD1AF20]<http://www.bas-rhin.fr/>

         Hôtel du Département
         1 place du Quartier Blanc 67964 Strasbourg Cedex 9
         Tél : 03 88 76 68 88 - mobile :
         Mobile : 06 30 96 31 76
         Email : sylvain.pierre at bas-rhin.fr<mailto:sylvain.pierre at bas-rhin.fr>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190923/706af3a2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 4599 bytes
Desc: image003.jpg
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190923/706af3a2/attachment-0001.jpg>

More information about the ckan-dev mailing list