prql icon indicating copy to clipboard operation
prql copied to clipboard

SQL Editor with 30+ Databases - close to PRQL support

Open ryanhamilton opened this issue 1 year ago • 13 comments

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

ryanhamilton avatar May 24 '24 08:05 ryanhamilton

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

vanillajonathan avatar May 24 '24 09:05 vanillajonathan

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...

max-sixty avatar May 24 '24 23:05 max-sixty

@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!

richb-hanover avatar May 25 '24 23:05 richb-hanover

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

ryanhamilton avatar May 29 '24 07:05 ryanhamilton

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!

richb-hanover avatar May 29 '24 13:05 richb-hanover

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.

ryanhamilton avatar May 31 '24 20:05 ryanhamilton

@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.

richb-hanover avatar May 31 '24 22:05 richb-hanover

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 avatar Jun 06 '24 10:06 ryanhamilton

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 :)

ryanhamilton avatar Jun 06 '24 10:06 ryanhamilton

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:

  • To make software for yourself, it takes X units of work
  • To make software for your colleagues, it takes 3X
  • To make generally useful software, it takes 9X

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

richb-hanover avatar Jun 06 '24 11:06 richb-hanover

@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

richb-hanover avatar Jun 06 '24 11:06 richb-hanover

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

vanillajonathan avatar Jun 06 '24 11:06 vanillajonathan

Congrats on the HN exposure @ryanhamilton !

max-sixty avatar Jun 06 '24 18:06 max-sixty

Closing as resolved and thanks to @richb-hanover I'm managing to close out some bugs. Thanks for your help.

ryanhamilton avatar Sep 16 '24 08:09 ryanhamilton