← Back to team overview

dhis2-devs team mailing list archive

[Bug 1285088] Re: error importing category option data using csv

 

Seeing a similar issue on a different server when trying to import CSV's
with Catcombos and Attribute combos:

>From the DHIS2 Dev Manual:
"dataelement","period","orgunit","categoryoptioncombo","attributeoptioncombo","value","storedby","timestamp","comment","followup"

Example CSV File:
WxyMUZ6JyOs,2013Q4,hDjfxomxnzv,Rm4MfoUFybz,SQvRBX9Hahd,6,admin,20131231,,FALSE
WxyMUZ6JyOs,2014Q2,TdZgNiLeqJq,gU4ygE5Olh8,divRD6I7jCm,28,admin,20140630,,FALSE

Output from server:
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "dataelement_name_key"
 Detail: Key (name)=(CP Activities Planned) already exists.
       at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)
       at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)
       at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)
       at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)
       at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
       at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
       ... 130 more
* ERROR 2015-05-18 16:08:54,278 HHH000352: Unable to release batch statement... (AbstractBatchImpl.java [http-bio-8080-exec-582])
* ERROR 2015-05-18 16:08:54,279 HHH000246: SQLException escaped proxy (AbstractBatchImpl.java [http-bio-8080-exec-582])
java.sql.SQLException: You can't operate on a closed Statement!!!

I converted my csv file to sql (replacing the UIDs with IDs where
appropriate) and it ran just fine, but that was skipping the entire
GUI/Tomcat and going straight to the PostgreSQL server.

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/1285088

Title:
  error importing category option data using csv

Status in DHIS 2:
  New

Bug description:
  For some reason I am struggling to import data for category options
  using csv. It works fine with default but I keep getting an error
  which rates the default ID (totals) already exists. This happens even
  when there isn't any data in the datavalue table.

  Version:
  2.15-SNAPSHOT
  Build revision:
  14103

  Extract of log below :

  * ERROR 2014-02-26 10:52:41,859 java.lang.RuntimeException: Failed to add objects
          at org.amplecode.quick.batchhandler.AbstractBatchHandler.addObject(AbstractBatchHandler.java:210)
          at org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService.saveDataValueSet(DefaultDataValueSetService.java:432)
          at org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService.saveDataValueSetCsv(DefaultDataValueSetService.java:243)
          at org.hisp.dhis.importexport.action.util.ImportDataValueTask.run(ImportDataValueTask.java:78)
          at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
          at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
  Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "datavalue_pkey"
    Detail: Key (dataelementid, periodid, sourceid, categoryoptioncomboid, attributeoptioncomboid)=(1851, 1988, 58, 15, 15) already exists.
          at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
          at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
          at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
          at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
          at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:403)
          at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:331)
          at org.amplecode.quick.batchhandler.AbstractBatchHandler.addObject(AbstractBatchHandler.java:191)
          ... 11 more

  Any ideas why?

  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/dhis2/+bug/1285088/+subscriptions


References