by emersion · 6y ago · 0 comments
I appreciate the effort to make it easier for users to access heterogeneous data sets, but I really hope data vendors keep shipping raw CSV files. I don't want a company to gate access to the data, merely offering a proxy. I want to be able to download the whole raw datasets from the vendor directly if I want to.
For what it's worth, we run PostgREST [0] on top of the DDN, so you can get your query results in JSON and CSV files. For example:
$ curl -sSH "Content-Type: text/csv" https://data.splitgraph.com/cityofchicago/covid19-daily-cases-deaths-and-hospitalizations-naz8-j4nc/latest/-/rest/covid19_daily_cases_deaths_and_hospitalizations | wc -l
172
It's limited to 10k rows but we might have an ability in the future to "order" a CSV dump asynchronously and place in a destination (like an S3 bucket) of choice.For the REST API endpoints (e.g. [0] [1]), we do set the Access-Control-Allow-Origin header to *, but for GET requests we do not send it at all. I'm not sure if this is the same as setting it to star. We can set it explicitly though; we do want to enable this use case (eventually we'll have quotas).
Soon we're releasing a Web UI for writing SQL queries. Part of that will include an HTTP (or websocket maybe) endpoint that takes a SQL query and returns the rows, so you'll be able to execute SQL queries directly from the browser.
As an aside, we'd love to get this working with Observable! Let us know anything we can do to help. You can email me at miles@splitgraph.com or join the Discord and we can figure it out :)
[0] Docs: https://www.splitgraph.com/cambridgema-gov/covid19-cumulativ...
[1] Endpoint (powered by PostgREST): https://data.splitgraph.com:443/cambridgema-gov/covid19-cumu...
If you're testing with the same endpoints, you may need to give the cache a few minutes to evict the old values missing the header.
$ curl -sH "Accept: text/csv" https://data.splitgraph.com/cityofchicago/covid19-daily-cases-deaths-and-hospitalizations-naz8-j4nc/latest/-/rest/covid19_daily_cases_deaths_and_hospitalizations?select=lab_report_date,cases_total,deaths_total | head -n5
lab_report_date,cases_total,deaths_total
2020-03-01,0,0
2020-03-02,0,0
2020-03-03,0,0
2020-03-04,0,0Probably the closest thing I'm aware of is handing around a sqlite file, but I'm a little uneasy using a format that's meant to be a database as a transfer format. Dolt looks promising here too. Are there other ways?
Note, we use mostly Python, some R, and a various range of ML or Optimisation tools, depending on the project.
https://medium.com/ssense-tech/csv-vs-parquet-vs-avro-choosi...
It's well-supported in Pandas and Kafka, has good schema support, and reasonably small compressed file sizes.
Behind the scenes, we store them as cstore_fdw [2] files which is a columnar storage format that helps with analytical queries.
[0] https://github.com/splitgraph/splitgraph/
That said, a simple compressed .sql file of INSERT statements can often go a long way.
The only reason CSV is widely used is because normal people think of data as spreadsheets, and asking them to fire up a database and shred JSON data into it is ridiculous when they just want to whip up a line graph or answer a simple question (e.g. "What was value X on a this particular date?").
This idea makes such sense it's a little surprising nobody did it before.
In cases where that's not enough, you could roll your own types by putting the values in plain strings and it would still be strictly more expressive than CSV
There's no comprehensive single specification. The closest is an RFC which completely misses major pieces (eg handling of binary data, and more).
Using SQLite as the interchange format is better. :)