Show HN: OctoSQL – Query and join multiple databases and files, written in Go
github.com
github.com
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!
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...
PG community extensions - https://pgxn.org/
There are a lot of open-source or free extensions to make PG as a data platform rather than just a RDBMS.
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...
http://www.postgresqltutorial.com/import-csv-file-into-posgr...
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
I like both of them personally. Postgres didn't used to have as strong of a showing on Windows, and not as fancy tools as Management Studio/Query Analyzer/Azure Data Studio, but I think today Postgres is absolutely viable to replace SQL Server if you want to switch to open source.
> could you explain why you prefer postgres?
I don't have many reasons to be honest. Both MSSQL and Postgres are fine I guess but I like that Postgres is open source and so I can use it in personal projects for fun.
I guess the thing I hate the most about MSSQL is that, at work, we never have the latest version, because why pay again. And every single time I search how to do something I must use the less optimal way since the new way only works on the latest version.
At least with Postgres I can always run the latest version.
DBs handle and manipulate data better far better than excel. Excel does data presentation better.
A decent DB, well looked after and backed up, is the safest place for any quantity of data. Spreadsheets are not - excel is not reliable once you start filling it up and doing complex updates.
So that's my advice. Of course your needs and workflow may not fit that at all well, so YMMV!
Thanks for the opinion on mssql vs postgres.
Use "EXPLAIN VERBOSE" before your query to get more info.
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]!
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.
https://blog.hasura.io/remote-joins-a-graphql-api-to-join-da...
Does it support writing to (single) data sources too or only reading queries?
You can use the csv output format though and later import that somewhere.
https://www.altinity.com/blog/2019/6/11/clickhouse-local-the...
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!)
Will surely be researching on how they approached it.
Thanks for it! Will surely help us going forward.
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.
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)
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 ;)
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.
Something similar (with a GUI) is https://www.dremio.com/ that I think has gained some traction.