1
votes

I'm trying to upload a csv file to datastore using appcfg.py. The command I'm using is this:

appcfg.py upload_data --application=s~hay-fe --kind=CasillaFinal --filename=CasillaFinal.csv --url=http://hay-fe.appspot.com/remote_api --config_file=bulkloader.yaml

Then I get the next error:

BadArgumentError: Expected an integer id or string name as argument 2; received None (a NoneType).

This is my CasillaFinal.csv: http://pastebin.com/embed_js.php?i=7dp24Yn1

And this is my bulkloader.yaml: http://pastebin.com/embed_js.php?i=iPE8PcZQ

I think the problem is with the first column (ID), because I don't have any transformation for the import, but I don't know how to do this transformation.

Here you have the java definition of the 'table':

private @Id Long id;
private Key<EntidadFederativa> claveEntidad;
private int seccion;
private String tipoCasilla;
private String domicilio;
private String ubicacion;
private String referencia;
private String latitud;
private String longitud;
private int distrito;
private int claveMunicipio;
private String municipio;
private String letraInicial;
private String letraFinal;
private String casillaEspecial;

I'm using objectify for the persistence as you can see.

By the way, I would like to know if is important the order of the columns because the order in datastore admin is not the same that in csv file. Here is the order in datastore:

id|casillaEspecial|claveEntidad|claveMunicipio|distrito|domicilio|latitud|letraFinal|letraInicial|longitud|municipio|referencia|seccion|tipoCasilla|ubicacion

whereas in csv is:

id|claveEntidad|seccion|tipoCasilla|domicilio|ubicacion|referencia|latitud|longitud|distrito|claveMunicipio|municipio|letraInicial|letraFinal|casillaEspecial

Finally, I would like to know if the order index starts at 0 or 1, because the error says that the error is in argument 2 (Expected an integer id or string name as argument 2).

1

1 Answers

0
votes

I have found that it was missing the header in the csv file, when I added the header it started to work.