calpaterson / csvbase

a simple website for sharing table data - with an API
https://csvbase.com
GNU Affero General Public License v3.0
374 stars 13 forks source link

Creating a new table with the same name as one of your existing ones gets a 500 #31

Open calpaterson opened 1 year ago

calpaterson commented 1 year ago

Description

If you already have a table called "X" and try to paste a new "X" you get a 500

Steps to reproduce

  1. Upload a table called "X"
  2. Upload a table called "X"

Expected result

Some kind of 4xx response (ideally with the suggestion to upsert!)

Actual result

500 response

Additional details

Wingysam commented 1 year ago

This happened to me yesterday when I attempted to replace Galaxy/Ships, do you find these bugs by looking at logs?

calpaterson commented 1 year ago

Yep, I look at logs and at the dashboard of a third party service that records crashes. And yes - this bug is an anonymised version of what you ran into :)

Wingysam commented 1 year ago

Can there be some way to replace all data in a table at once in bulk?

calpaterson commented 1 year ago

Aha yes, that functionality already exists via the API in a semi-undocumented fashion:

curl -n https://csvbase.com/calpaterson/example | vipe | curl -n https://csvbase.com/calpaterson/example -X PUT --data-binary @-

-n means you need to put your username/apikey in ~/.netrc eg:

machine csvbase.com
  login calpaterson
  password aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

And vipe is available in the moreutils package.

But yes, it needs to be accessible via the web UI and I've just filed that as https://github.com/calpaterson/csvbase/issues/35