310 points · by cube2222 · 7y ago · 70 comments
The motivation behind this project is that I always wanted a simple commandline tool allowing me to join data from different places, without needing to set up stuff like presto or spark. On another hand, I never encountered any tool which allows me to easily query csv and json data using SQL (which at least in my opinion is fairly ergonomic to use).
This started as an university project, but we're now continuing it as an open source one, as it's been a great success so far.
Anyways, feedback greatly requested and appreciated!
This exactly describes Drill (https://drill.apache.org/) which can query any data source under the sun (RDBMS, NoSQL, files, clusters, serialized data (JSON, CSV, Parquet...), object storage (S3, OpenStack, ...)) using SQL and JOIN between them with pushdown optimizations. It's got an awesome CLI and can be used in any language via REST or JDBC.
Is there a way to connect this to other databases, to basically have views of your redis/MySQL/other databases in postgres?
https://www.postgresql.org/docs/11/contrib-dblink-function.h...
I used to work for a company that made a data federation software platform. I am always surprised that people forget that management of external data is part of the SQL standard actually - SQL/MED ("SQL Management of External Data") [1]!
What would be the best way to use the data from a huge Excel file into my web apps?
Currently I'm converting it to CSV and use `BULK INSERT` with MSSQL. I know that with MSSQL I can also use Excel files as "external database" but AFAIK, Excel files are not indexed and are super slow when used as an "external database".
I wouldn't mind switching to Postgres. I actually prefer Postgres.
https://www.cybertec-postgresql.com/en/tech-preview-improvin...
As a decades-long user of MSSQL guy who is getting sick of being rpeatedly done over by MS, could you explain why you prefer postgres? That would be incredibly interesting, TIA
http://www.postgresqltutorial.com/import-csv-file-into-posgr...
Use "EXPLAIN VERBOSE" before your query to get more info.
https://blog.hasura.io/remote-joins-a-graphql-api-to-join-da...
It's a great start with tons of directions you can take it, and many interesting challenges along the way - keep up the good work!
Tools I've written so far include:
https://github.com/simonw/csvs-to-sqlite - convert CSV files to a SQLite database
https://sqlite-utils.readthedocs.io/en/stable/cli.html - convert JSON files
https://github.com/simonw/db-to-sqlite - export data from any SQL database supported by SQLAlchemy (e.g. MySQL and PostgreSQL) into a SQLite file
More tools here: https://datasette.readthedocs.io/en/stable/ecosystem.html#to...
The end goal is to have databases I can load up in my Datasette web application tool so I can run SQL and export the results as JSON/CSV: https://datasette.readthedocs.io/
However, we're aiming for datasources which are either too big to download or change frequently, so also have very different goals really. (the same SQL for everything inspiration though!)
https://www.altinity.com/blog/2019/6/11/clickhouse-local-the...
The ASF's mission is not focused on bringing one best-of-breed product in every category. More, the ASF is focused on the stewardship and delivery of the software. They are more interested in the organization and community surrounding the project than the code itself.
Will surely be researching on how they approached it.
Thanks for it! Will surely help us going forward.
function csv_to_sqlite() {
echo "used as csv_to_sqlite PATH_TO_CSV TABLE_NAME"
sqlite3 -csv -cmd ".import $1 $2" -cmd ".headers on"
}
Two suggestions:1. It would be a lot more useful if I could link an entire database rather than just tables
2. Sometimes I just want to query a single CSV, so a command line argument where I can just specify the path would be nice
1. Initially we wanted to do one table per config-entry, but that'll be an easy to do UX improvement.
2. We're planning to add support for piping the csv/json file through stdin! That would be the most seamless workflow I think.
select * from tbl as t
not select * from tblThe Go standard library really helped handling all the different json file formats you might expect. (Like being a whole file table, or record per line)
You might be interested in Dremio (which is a modernized and open source version of Drill, but also has a commercial version) too. I had previously studied Spark, PrestoDb and Hive, among other things, for similar purposes.
If you ever want to chat feel free to contact me via my profile email.
If anyone is interested I'd love to chat: steve (at) syndetic.co
We're obviously surely not as battle tested, this being the initial release, but hopefully we'll be able to compare favorably!
The query optimizer is kinda simple currently. Mostly pushing down filters under maps and pushing supported workloads down to the datasources. Though I don't know how it will evolve going further ;)
Something similar (with a GUI) is https://www.dremio.com/ that I think has gained some traction.