ckan / datapusher

A standalone web service that pushes data files from a CKAN site resources into its DataStore
GNU Affero General Public License v3.0
77 stars 155 forks source link

Upload CSV / GeoJSON #70

Closed jordipiqueres closed 9 years ago

jordipiqueres commented 9 years ago

Hi all!

I am using CKAN 2.3 and the latest DataPusher version. I am trying to upload a CSV and GeoJSON and I am getting some errors:

CSV (first time was Ok but secondly I am getting this error):

[Mon Mar 30 16:10:03 2015] [error] Determined headers and types: [{'type': u'numeric', 'id': u'CODI_CARRER'}, {'type': u'text', 'id': u'CODI_CARRER_INE'}, {'type': u'text', 'id': u'SIGLA'}, {'type': u'text', 'id': u'NOM_OFICIAL'}, {'type': u'text', 'id': u'NOM_CURT'}, {'type': u'text', 'id': u'NRE_MIN'}, {'type': u'text', 'id': u'NRE_MAX'}] [Mon Mar 30 16:10:03 2015] [error] Saving chunk 0 [Mon Mar 30 16:10:03 2015] [error] Saving chunk 1 [Mon Mar 30 16:10:03 2015] [error] Saving chunk 2 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 3 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 4 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 5 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 6 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 7 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 8 [Mon Mar 30 16:10:04 2015] [error] Saving chunk 9 [Mon Mar 30 16:10:05 2015] [error] Saving chunk 10 [Mon Mar 30 16:10:05 2015] [error] Saving chunk 11 [Mon Mar 30 16:10:05 2015] [error] Saving chunk 12 [Mon Mar 30 16:10:05 2015] [error] Saving chunk 13 [Mon Mar 30 16:10:05 2015] [error] Saving chunk 14 [Mon Mar 30 16:10:05 2015] [error] Fetching from: http://ckan.cat:5000/dataset/097cb1d9-8227-4e70-b90b-0b7b3ba1a8cf/resource/f20f4931-3cee-414f-991d-00a95b0d6a2a/download/carrerer0opendata2.csv [Mon Mar 30 16:10:05 2015] [error] Saving chunk 15 [Mon Mar 30 16:10:05 2015] [error] Deleting "f20f4931-3cee-414f-991d-00a95b0d6a2a" from datastore. [Mon Mar 30 16:10:06 2015] [error] Saving chunk 16 [Mon Mar 30 16:10:06 2015] [error] Determined headers and types: [{'type': u'numeric', 'id': u'CODI_CARRER'}, {'type': u'text', 'id': u'CODI_CARRER_INE'}, {'type': u'text', 'id': u'SIGLA'}, {'type': u'text', 'id': u'NOM_OFICIAL'}, {'type': u'text', 'id': u'NOM_CURT'}, {'type': u'text', 'id': u'NRE_MIN'}, {'type': u'text', 'id': u'NRE_MAX'}] [Mon Mar 30 16:10:06 2015] [error] Saving chunk 0 [Mon Mar 30 16:10:06 2015] [error] Saving chunk 17 [Mon Mar 30 16:10:06 2015] [error] Job "push_to_datastore (trigger: RunTriggerNow, run = True, next run at: None)" raised an exception [Mon Mar 30 16:10:06 2015] [error] Traceback (most recent call last): [Mon Mar 30 16:10:06 2015] [error] File "/usr/lib/ckan/datapusher/lib/python2.7/site-packages/apscheduler/scheduler.py", line 512, in _run_job [Mon Mar 30 16:10:06 2015] [error] retval = job.func(_job.args, *_job.kwargs) [Mon Mar 30 16:10:06 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 321, in push_to_datastore [Mon Mar 30 16:10:06 2015] [error] records, api_key, ckan_url) [Mon Mar 30 16:10:06 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 150, in send_resource_to_datastore [Mon Mar 30 16:10:06 2015] [error] check_response(r, url, 'CKAN DataStore') [Mon Mar 30 16:10:06 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 84, in check_response [Mon Mar 30 16:10:06 2015] [error] resp=pprint.pformat(json_response))) [Mon Mar 30 16:10:06 2015] [error] JobError: CKAN DataStore bad response. Status code: 409 Conflict. At: http://localhost:5000/api/3/action/datastore_create. Response: {u'error': {u'type': u'Validation Error', [Mon Mar 30 16:10:06 2015] [error] u'constraints': [u'Cannot insert records or create index because of uniqueness constraint'], [Mon Mar 30 16:10:06 2015] [error] u'info': {u'orig': u'duplicate key value violates unique constraint "pg_type_typname_nsp_index"\nDETAIL: Key (typname, typnamespace)=(f20f4931-3cee-414f-991d-00a95b0d6a2aid_seq, 2200) already exists.\n', [Mon Mar 30 16:10:06 2015] [error] u'pgcode': u'23505'}}, [Mon Mar 30 16:10:06 2015] [error] u'help': u'http://localhost:5000/api/3/action/help_show?name=datastore_create', [Mon Mar 30 16:10:06 2015] [error] u'success': False}

JSON (the error emerges constantly):

[Mon Mar 30 15:56:11 2015] [error] Fetching from: http://ckan.cat:5000/dataset/06b02e6a-3a96-494f-8405-12e36ee5030d/resource/42460ac7-9dda-4b91-99f5-2ffbe9636d52/download/estacions.geojson [Mon Mar 30 15:56:12 2015] [error] Deleting "42460ac7-9dda-4b91-99f5-2ffbe9636d52" from datastore. [Mon Mar 30 15:56:12 2015] [error] Determined headers and types: [{'type': u'text', 'id': u'{ "type": "Feature"'}, {'type': u'text', 'id': u' "properties": { "LINIA": "LINIES_CONVENCIONALS"'}, {'type': u'text', 'id': u' "ESTAT": "Estat actual"'}, {'type': u'text', 'id': u' "INTERCANVIADOR": null'}, {'type': u'text', 'id': u' "NOM_ESTACIO": "Vimbod\xed"'}, {'type': u'text', 'id': u' "XARXA": "ADIF" }'}, {'type': u'text', 'id': u' "geometry": { "type": "Point"'}, {'type': u'text', 'id': u' "coordinates": [ 336671.35572722001'}, {'type': u'numeric', 'id': u' 4585317.9943092503'}, {'type': u'text', 'id': u' 0.0 ] } }'}] [Mon Mar 30 15:56:12 2015] [error] Saving chunk 0 [Mon Mar 30 15:56:12 2015] [error] Job "push_to_datastore (trigger: RunTriggerNow, run = True, next run at: None)" raised an exception [Mon Mar 30 15:56:12 2015] [error] Traceback (most recent call last): [Mon Mar 30 15:56:12 2015] [error] File "/usr/lib/ckan/datapusher/lib/python2.7/site-packages/apscheduler/scheduler.py", line 512, in _run_job [Mon Mar 30 15:56:12 2015] [error] retval = job.func(_job.args, *_job.kwargs) [Mon Mar 30 15:56:12 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 321, in push_to_datastore [Mon Mar 30 15:56:12 2015] [error] records, api_key, ckan_url) [Mon Mar 30 15:56:12 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 150, in send_resource_to_datastore [Mon Mar 30 15:56:12 2015] [error] check_response(r, url, 'CKAN DataStore') [Mon Mar 30 15:56:12 2015] [error] File "/usr/lib/ckan/datapusher/src/datapusher/datapusher/jobs.py", line 84, in check_response [Mon Mar 30 15:56:12 2015] [error] resp=pprint.pformat(json_response))) [Mon Mar 30 15:56:12 2015] [error] JobError: CKAN DataStore bad response. Status code: 409 Conflict. At: http://localhost:5000/api/3/action/datastore_create. Response: {u'error': {u'__type': u'Validation Error', [Mon Mar 30 15:56:12 2015] [error] u'fields': [u'"{ "type": "Feature"" is not a valid field name']}, [Mon Mar 30 15:56:12 2015] [error] u'help': u'http://localhost:5000/api/3/action/help_show?name=datastore_create', [Mon Mar 30 15:56:12 2015] [error] u'success': False} [Mon Mar 30 16:08:47 2015] [error] Fetching from: http://localhost:5000/dataset/097cb1d9-8227-4e70-b90b-0b7b3ba1a8cf/resource/a66548ff-681f-448b-9387-6157ed9a27b7/download/carrerer0opendata.csv [Mon Mar 30 16:08:47 2015] [error] Deleting "a66548ff-681f-448b-9387-6157ed9a27b7" from datastore. [Mon Mar 30 16:08:47 2015] [error] Determined headers and types: [{'type': u'numeric', 'id': u'CODI_CARRER'}, {'type': u'text', 'id': u'CODI_CARRER_INE'}, {'type': u'text', 'id': u'SIGLA'}, {'type': u'text', 'id': u'NOM_OFICIAL'}, {'type': u'text', 'id': u'NOM_CURT'}, {'type': u'text', 'id': u'NRE_MIN'}, {'type': u'text', 'id': u'NRE_MAX'}]

What can I do to solve this errors?

jordipiqueres commented 9 years ago

I think the problem was releated with some tests I did previously installing ckanext-spatial plugin. I deleted all of these tests and tried to upload new CSV and Geojson files and the problem didn't appear again. Hope it helps to someone.