budibase icon indicating copy to clipboard operation
budibase copied to clipboard

CSV export fails for table with composite primary key

Open oldwired opened this issue 2 years ago • 0 comments

Hosting

  • Self
    • Method: docker
    • Budibase Version: 1.3.21

Describe the bug CSV export of table data fails with "Unexpected token ' in JSON at position 1" & "There was an error exporting the data".

Request:

[HTTP/1.1 400 Bad Request 45ms]

{"rows":["%5B'EVENT_2022_08'%2C210090%5D","%5B'EVENT_2022_08'%2C196380%5D","%5B'EVENT_2022_07'%2C3025438%5D"],"columns":["Zeit","Ereignis","Meldung"]}

Response

XHRPOSThttp://10.20.36.63:10000/api/datasource_plus_f7d8437791184209a01525052a7ea3ce__events/rows/exportRows?format=csv
[HTTP/1.1 400 Bad Request 45ms]

{"message":"Unexpected token ' in JSON at position 1","status":400}

To Reproduce Steps to reproduce the behavior:

  1. Use mySQL datasource
  2. Have table of mySQL datasource in provider and table - table has a composite primary key (Alphanumeric, numeric)
  3. allow row selection on table
  4. add CSV export action
  5. publish
  6. mark rows
  7. klick export

Expected behavior CSV export happens. With another table that has a single, numeric primary key it works. Could it have to do with the composite primary key (two fields, one alphanumeric, the other numeric) of this table?

working:

http://10.20.36.63:10000/api/datasource_plus_f7d8437791184209a01525052a7ea3ce__objekte/rows/exportRows?format=csv
{"rows":["%5B51342%5D","%5B51749%5D","%5B52173%5D"],"columns":["Objektnummer","Objektname"]}

Desktop (please complete the following information):

  • OS: Windows Server 2019
  • Browser Firefox
  • Version 104.0.2 (64-Bit)

Additional context Add any other context about the problem here.

oldwired avatar Sep 20 '22 13:09 oldwired