I'm doing the following via the API on a CKAN 2.5.2 installation that has DataStore + DataPusher enabled:
- Create a CSV resource
- Remove the default
recline_view
- Add a new
recline_grid_view view
I'd expect the resource to end up with a single view (the one I added in step 3). However, it ends up with two views: the one I created and a new default view (ID is different from the original default view).
It seems that the default view is added again once the data has been uploaded to the DataStore by the DataPusher. If steps 1-3 are done quickly enough (before the upload to the DataStore has completed) then the resource has only the intended recline_grid_view, which at that point shows an error (because the data is not yet available). As soon as the data is available (i.e. as soon as the error is gone after a reload) the resource has gotten an additional recline_view.
Here's a small script to demonstrate the problem:
ckan = ckanapi.RemoteCKAN(CKAN_URL, apikey=API_KEY)
res_dict = ckan.action.resource_create(package_id=PKG_ID, url=CSV_URL,
name='Test', format='CSV')
view_dicts = ckan.action.resource_view_list(id=res_dict['id'])
for view_dict in view_dicts:
ckan.action.resource_view_delete(id=view_dict['id'])
ckan.action.resource_view_create(resource_id=res_dict['id'], title='My View',
view_type='recline_grid_view')
# Uncomment to make assertion fail
#import time
#time.sleep(10)
assert len(ckan.action.resource_view_list(id=res_dict['id'])) == 1
If you uncomment the sleep lines (to wait until the data is in the DataStore) then the assertion fails.
I'm doing the following via the API on a CKAN 2.5.2 installation that has DataStore + DataPusher enabled:
recline_viewrecline_grid_viewviewI'd expect the resource to end up with a single view (the one I added in step 3). However, it ends up with two views: the one I created and a new default view (ID is different from the original default view).
It seems that the default view is added again once the data has been uploaded to the DataStore by the DataPusher. If steps 1-3 are done quickly enough (before the upload to the DataStore has completed) then the resource has only the intended
recline_grid_view, which at that point shows an error (because the data is not yet available). As soon as the data is available (i.e. as soon as the error is gone after a reload) the resource has gotten an additionalrecline_view.Here's a small script to demonstrate the problem:
If you uncomment the
sleeplines (to wait until the data is in the DataStore) then the assertion fails.