[ckan-dev] Page view tracking issue

PIERRE Sylvain sylvain.pierre at bas-rhin.fr
Tue Sep 24 12:06:20 UTC 2019

Thanks Luke,
I definitively need to improve my knowledge around virtualenv and pip…
May-be I’m wrong but I think it’s not always clear in ckan doc.

For example:

Initialize database in main install doc part give (link<https://docs.ckan.org/en/latest/maintaining/installing/install-from-package.html#update-the-configuration-and-initialize-the-database>): sudo ckan db init

Initialize database in Database Management doc part (link<https://docs.ckan.org/en/latest/maintaining/database-management.html>): paster db init -c /etc/ckan/default/production.ini
So what’s the right way?
In my case paster commands fail.
In a production environment things are far different from a theorical case exposed in doc (eg: I have to pass commands with sudo account).

However, ckan remains a great product/project 😉


De : ckan-dev <ckan-dev-bounces at lists.okfn.org> De la part de Luke Tully
Envoyé : mardi 24 septembre 2019 00:56
À : ckan-dev at lists.okfn.org
Objet : Re: [ckan-dev] Page view tracking issue

Hi Pierre,

Your CKAN instance is going to point to the same virtualenv regardless of your config file, unless you’re separating your codebase between prod/dev. This issue is probably a result of your declaring those plugins in your production.ini file, but you may have forgot to actually install the python packages in your virtualenv.

1) Activate your virtualenv so that you can use paster
2) If you meant to install the plugin in place from source, you would cd to it’s directory
            a) pip install -e ./ (inside the source directly)
3) If you meant to install in site-packages (from pip without -e flag)
            a) pip install plugin_name

It could also be that you have installed those packages, but you’re using the wrong name in your .ini file. Check the setup.py for each plugin name, and use that in your .ini file.

Good luck!

Luke Tully,
University of Manitoba, CEOS

On September 23, 2019 at 7:45:46 AM, ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org> (ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org>) wrote:
Send ckan-dev mailing list submissions to
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
ckan-dev-request at lists.okfn.org<mailto:ckan-dev-request at lists.okfn.org>

You can reach the person managing the list at
ckan-dev-owner at lists.okfn.org<mailto:ckan-dev-owner at lists.okfn.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ckan-dev digest..."

Today's Topics:

1. Page view tracking issue (PIERRE Sylvain)


Message: 1
Date: Mon, 23 Sep 2019 14:40:31 +0000
From: PIERRE Sylvain <sylvain.pierre at bas-rhin.fr<mailto:sylvain.pierre at bas-rhin.fr>>
To: "'ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>'" <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
Subject: [ckan-dev] Page view tracking issue
Message-ID: <f1f71dccef7346dda4a88f6f02f584b0 at EXMBX-11.cg67.fr<mailto:f1f71dccef7346dda4a88f6f02f584b0 at EXMBX-11.cg67.fr>>
Content-Type: text/plain; charset="utf-8"

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><mailto: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.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.jpg>


Subject: Digest Footer

ckan-dev mailing list
ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>
Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


End of ckan-dev Digest, Vol 107, Issue 10
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190924/c4a46e1e/attachment-0002.html>

More information about the ckan-dev mailing list