[ckan-dev] How the database should be reset?
Richard Gomes
rgomes.info at gmail.com
Thu Aug 29 19:16:46 UTC 2013
hello,
I loaded test data provided by CKAN into the database.
I don't know if this is relavant... anyway, for your information:
After that I did some tests using the FileStore API, when I associated
documents to one of the datasets, like this:
1 base_location='http://ckan.localdomain:5000/api'
2 api_key= ...
3 http_user='rgomes'
4 http_pass=...
5
6
7 def filelist(folder='.'):
8 import os
9 for root, dir, files in os.walk(folder):
10 for file in files:
11 path = '%s/%s' % (root, file)
12 yield path
13 return
14
15
16 import ckanclient
17 cli = ckanclient.CkanClient(base_location=base_location,
api_key=api_key, http_user=http_user, http_pass=http_pass, is_verbose=True)
18
19 pkg = 'warandpeace'
20 for path in filelist('/home/rgomes/tmp/upload'):
21 print path
22 print cli.add_package_resource(pkg, path)
Then I've tried to recreate the database from scratch, like this:
#!/bin/bash
set -x
sudo -u postgres dropdb ${CKAN_DATABASE}
sudo -u postgres dropuser ${CKAN_USERNAME}
sudo -u postgres createuser -S -D -R -P ${CKAN_USERNAME}
sudo -u postgres createdb -O ${CKAN_USERNAME} ${CKAN_DATABASE} -E utf-8
paster db init -c $CKAN_ETC/default/development.ini
paster sysadmin add rgomes -c $CKAN_ETC/default/development.ini
set +x
Notice that I didn't loaded the test data after that!
For my surprise, CKAN says that there are 2 datasets available.
The datasets are not actually listed, but it says that there are 2
datasets available.
The faceted search tags associates 2 datasets to david and 1 to roger,
etc... like if the datasets where still there.
Any idea about how this sort of information survived a complete wipe out
of database tables ?
Thanks
--
Richard Gomes
http://rgomes.info
http://www.linkedin.com/in/rgomes
mobile: +44(77)9955-6813
inum <http://www.inum.net/>: +883(5100)0800-9804
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130829/4da379f8/attachment.html>
More information about the ckan-dev
mailing list