cartoframes: Dataset(df).upload() doesn't work if the only columns are the_geom and cartodb_id

It seems to want more columns when it builds a query:

CartoException: Batch SQL job failed with result: {'user': 'eschbacher', 'status': 'failed',
'query': "BEGIN; DROP TABLE IF EXISTS test_upload; CREATE TABLE test_upload (, the_geom geometry(MultiPolygon, 4326)); SELECT CDB_CartodbfyTable('eschbacher', 'test_upload'); COMMIT;",
'created_at': '2019-08-20T18:26:51.936Z',
'updated_at': '2019-08-20T18:26:51.954Z',
'failed_reason': 'syntax error at or near ","',
'job_id': '5b6a1396-5b6d-4581-808f-27c3c8947464'}

Specifically, you can see the query it constructs here:

CREATE TABLE test_upload (, the_geom geometry(MultiPolygon, 4326))

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

I wouldn’t add specific logic like renaming columns, check nulls, existence, etc.

I’d upload what we have and when cartodbfying if there’s an error (because cartodb_id is not unique for example), the backend will raise an error and the user should have to modify their dataframe to make it work (in most cases by just dropping or resetting the cartodb_id column). We can just solve this with good documentation.

I’d prefer we are able to explain a simple process so that users can understand it, than adding too much magic and find lots of corner cases (in any case we can add magic in the future, once we understand how users upload data).

convert it into the index (remove current index) and upload it

About this, IIRC we upload the index as a regular column so when download back the dataset, the index is cartodb_id and you keep your previous index as a column.

My 2 cents.