PRQL / prql

PRQL is a modern language for transforming data — a simple, powerful, pipelined SQL replacement
https://prql-lang.org
Apache License 2.0
9.6k stars 208 forks source link

SQL Editor with 30+ Databases - close to PRQL support #4502

Open ryanhamilton opened 1 month ago

ryanhamilton commented 1 month ago

What's up?

"We’d like to make it easier to try PRQL. We currently have the playground, which compiles PRQL and runs queries with a DuckDB wasm module, but there’s much more we could do. "

Hi,

I have just added PRQL syntax highlighting to qStudio (screenshot below). QStudio is a free and open core SQL Editor for data analysts (https://www.timestored.com/qstudio/). Today it only highlights code but it would be very easy to add the ability to run PRQL against all 30+ supported databases.

The main blocker is that I don't want to add ~20MB plus to the download size of qStudio (99MB) for functionality not many people may use. My proposal:

  1. PRQL to commonly provide a binary/.exe for each platform and recommend people install it to their path.
  2. Tools like qStudio can then run prql.exe "prql-code" to convert it to SQL
  3. qStudio would then run that SQL.

Or I am open to alternative suggestions.

image

vanillajonathan commented 1 month ago

I cannot find your commit to qStudio for PRQL syntax highlighting.

We have the prqlc (PRQL compiler) tool that you can install using winget:

winget install prqlc
max-sixty commented 1 month ago

Hi @ryanhamilton ! qStudio looks great, nice work...

That would be super from our end. We do already produce binaries, for example: https://github.com/PRQL/prql/releases/tag/0.11.4

FWIW my guess is that asking folks to add the binary to their path might be difficult for the average user. I get the reluctance to make your binary heavier, though the compressed binaries are 3-5MB at that link...

There was some work to make a Java binding — we still run tests on it, so it very likely works — though I haven't heard of that many folks using it...

richb-hanover commented 1 month ago

@ryanhamilton This is SO COOL! I downloaded a copy and I like it a lot. (This seems pretty mature - you even support different themes, which makes me happy. (I'm a Solarized Light kind of guy :-)) Adding direct support for PRQL would make my day.

I found a few rough edges while I was downloading/installing. What's the best place for me to offer comments/suggestions? Thanks!

ryanhamilton commented 1 month ago

Thanks @max-sixty @vanillajonathan - That worked! This is now done and well I think it's pretty cool :) I tried querying sqlite, duckdb and H2, all of them just worked. If you download the latest 3.02+ it's in there: https://www.timestored.com/qstudio/prql-ide

What's the best place for me to offer comments/suggestions?

@richb-hanover The best place is on github: https://github.com/timeseries/qstudio/issues If possible please star the project as after 13 years I'm trying to fully open source the project: https://github.com/timeseries/qstudio/issues/43

The one thing I wasn't sure of is what separator PRQL uses between separate statements. I assumed ;.

If it gets enough users I can see about adding automatic download of prqlc. 🚀 👍

prql-sql-ide

richb-hanover commented 1 month ago

Oh wow! I so want to look at this (but it'll probably have to wait 'til this weekend...)

PS PRQL is line-based - there are no "end of line" separators. Thanks!

ryanhamilton commented 1 month ago

Thanks for your help @richb-hanover , between us we got it working. 👍 I hope you find it useful and this proves an easy way to get PRQL to more users. Now any database should be usable with PRQL.

I have added a custom demo page: https://www.timestored.com/qstudio/prql-ide and I will shortly email our existing userbase to announce the support.

richb-hanover commented 1 month ago

@ryanhamilton I would hold off on a big announcement. I tried it with a big query that works fine when I paste the SQL into SQLiteBrowser, but throws an error in qStudio. (That's what I had in mind in my note at https://github.com/timeseries/qstudio/issues/44.) I'll aim to get a complete report to you by this weekend. Thanks again.

ryanhamilton commented 1 month ago

It would be good to get some more PRQL users really using qStudio to iron out any bugs or to raise feature suggestions. Could qStudio be added to the list of integrations? I'm happy to raise the PR but wasn't sure if you would welcome it or not. Let me know.

image

ryanhamilton commented 1 month ago

FYI The new qStudio with PRQL reached the top of HN https://news.ycombinator.com/item?id=40562210 https://www.timestored.com/qstudio/release-version-3 So there's at least 1000+ people with a version that has the integration already :)

richb-hanover commented 1 month ago

Congratulations on HN coverage! I especially like this:

Year 1 - Getting the first version out that worked for me and my colleagues. Year 2 - Cleaning it up enough to promote wider use. Documentation. Years 3-5 - Minor bug fixes only as I thought qStudio solved the problem. Years 6 - I realised restricting qStudio to only 1-2 database technologies was foolish. Major change to support many more databases. Improved generic SQL highlighting. Added a partial dark mode. Years 7-8 - Minor bug fixes. Year 9 - Added a proper Dark Mode and support for many themes by using FlatLaf. Now looking properly modern. Year 10 - Realise that I'm not fully solving the problem. That actually for most data analysts I should support creating the analysis (pivot table) and improve exporting (real excel export, not just nicely escaped CSV).

That comports with my mentor's adage:

It sounds reasonable to have qStudio listed as an integration. I'll talk it up. Thanks again

richb-hanover commented 1 month ago

@max-sixty I've been having a lot of fun with qStudio. Any reason we shouldn't list it as an integration? (It is, after all...) Thanks

Update: I raised a PR #4547

vanillajonathan commented 1 month ago

@ryanhamilton I cannot find your commit to qStudio for PRQL syntax highlighting.

max-sixty commented 1 month ago

Congrats on the HN exposure @ryanhamilton !