[ckan-dev] Dataset upload error

Cliff Ingham inghamn at bloomington.in.gov
Thu Feb 6 14:28:58 UTC 2014


I finally found the _table_metadata table.  It's in the datastore
database.  According to the documentation, this should be owned by the
writeuser, which it was.

I had to grant select permission on that table to the readonly user.  I
don't think the datastore setup script set this correctly.

Other than the possible problem with the datastore database setup
script, I think this is just documentation confusion - especially given
that I am new to Python applications and Postgresql.

On 02/06/2014 04:34 AM, Nigel Babu wrote:
> Hi Cliff,
> 
> I have a few questions for you that might help us debug your situation a
> bit better.
> * Does the db user used to connect to the database own the database used
> for CKAN?

Which db user and which database?

> * Did you create the database using the steps described in the
> documentation?
> * What version of CKAN are you on?
This is a source install, cloned from the master branch.  (Yes, I know
there could be problems)  However, this was not something that was
expected to be broken.  I just recently upgraded to the latest commit,
as of sometime on Tuesday.

> * Do you have any custom extensions enabled?
No, nothing custom:
ckan.plugins = stats text_preview recline_preview datastore datapusher
spatial_metadata spatial_query
> 
> 
> Nigel Babu
> 
> Developer  |  @nigelbabu <https://twitter.com/nigelbabu>
> 
> The Open Knowledge Foundation <http://okfn.org/>
> 
> Empowering through Open Knowledge
> 
> http://okfn.org/  |  @okfn <http://twitter.com/OKFN>  |  OKF on
> Facebook<https://www.facebook.com/OKFNetwork> |
> Blog <http://blog.okfn.org/>  |  Newsletter<http://okfn.org/about/newsletter>
> 
>  CKAN | http://ckan.org/ | @CKANproject
> <http://twitter.com/CKANproject> |the world’s leading open-source data
> portal platform
> 
> 
> On 5 February 2014 22:44, Cliff Ingham <inghamn at bloomington.in.gov> wrote:
> 
>> I am getting a postgresql error when attempting to upload a file for a
>> dataset.
>>
>> (ProgrammingError) permission denied for relation _table_metadata
>>
>> I have tried the Alter Table command as described from an older email in
>> this mailing list:
>> https://lists.okfn.org/pipermail/ckan-dev/2012-October/003227.html
>>
>> ALTER DEFAULT PRIVILEGES FOR USER "{writeuser}" IN SCHEMA public
>>    GRANT SELECT ON TABLES TO "{readonlyuser}";
>>
>> But still, no luck.  I am unfamiliar with Postgres and am not sure where
>> the _table_metadata table is. (This is my first use of Postgres, I have
>> only use MySQL, Oracle, and MSSql before.)
>>
>> Here's the full error from the log:
>>
>> (ProgrammingError) permission denied for relation _table_metadata
>>  'SELECT 1 FROM "_table_metadata" WHERE name = %s AND alias_of IS NULL'
>> (u'2bba4af2-95e4-43c4-b555-970d0d59a10d',)
>> Traceback (most recent call last):
>>   File "/srv/sites/ckan/python_env/src/ckan/ckan/model/modification.py",
>> line 79, in notify
>>     observer.notify(entity, operation)
>>   File
>> "/srv/sites/ckan/python_env/src/ckan/ckan/lib/search/__init__.py", line
>> 128, in notify
>>     {'id': entity.id}),
>>   File "/srv/sites/ckan/python_env/src/ckan/ckan/logic/__init__.py",
>> line 419, in wrapped
>>     result = _action(context, data_dict, **kw)
>>   File "/srv/sites/ckan/python_env/src/ckan/ckan/logic/action/get.py",
>> line 856, in package_show
>>     resource_dict = item.before_show(resource_dict)
>>   File
>> "/srv/sites/ckan/python_env/src/ckan/ckanext/datastore/plugin.py", line
>> 245, in before_show
>>     resource_dict['id']
>>   File
>>
>> "/srv/sites/ckan/python_env/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
>> line 1449, in execute
>>     params)
>>   File
>>
>> "/srv/sites/ckan/python_env/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
>> line 1628, in _execute_text
>>     statement, parameters
>>   File
>>
>> "/srv/sites/ckan/python_env/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
>> line 1698, in _execute_context
>>     context)
>>   File
>>
>> "/srv/sites/ckan/python_env/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
>> line 1691, in _execute_context
>>     context)
>>   File
>>
>> "/srv/sites/ckan/python_env/lib/python2.7/site-packages/sqlalchemy/engine/default.py",
>> line 331, in do_execute
>>     cursor.execute(statement, parameters)
>> ProgrammingError: (ProgrammingError) permission denied for relation
>> _table_metadata
>>  'SELECT 1 FROM "_table_metadata" WHERE name = %s AND alias_of IS NULL'
>> (u'2bba4af2-95e4-43c4-b555-970d0d59a10d',)
>> Error - <class 'sqlalchemy.exc.ProgrammingError'>: (ProgrammingError)
>> permission denied for relation _table_metadata, referer:
>>
>> http://rogue.bloomington.in.gov/ckan/dataset/new_resource/video-services-franchise-revenue-history
>>  'SELECT 1 FROM "_table_metadata" WHERE name = %s AND alias_of IS NULL'
>> (u'2bba4af2-95e4-43c4-b555-970d0d59a10d',), referer:
>>
>> http://rogue.bloomington.in.gov/ckan/dataset/new_resource/video-services-franchise-revenue-history
>> --
>> Cliff Ingham
>> http://www.ohloh.net/accounts/inghamn
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
> 
> 
> 
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> 



More information about the ckan-dev mailing list