Sequel-ace: Add "Show Query" button next to "Filter" button

Created on 10 Aug 2020  路  11Comments  路  Source: Sequel-Ace/Sequel-Ace

It would be great if there were a "Show Query" button next to the "Filter" button in the content filters area (see arrow in screenshot). I know that queries are available in the Console after they're executed, but having an option here would allow you to see a preview of the filter query you're about to run, before you run it.

I would expect that clicking "Show Query" would add a row with a read-only text area (similar to the text area in the "Advanced Filter Content" panel), immediately above the row with the Show Query / Filter buttons. The "Show Query" button would change to "Hide Query" while the query row is visible.

Screen Shot 2020-08-10 at 11 50 05 AM

Enhancement Low priority PR Welcome

Most helpful comment

Sort of got something working ... needs work though.

2020-08-11 06 02 07

All 11 comments

Sort of got something working ... needs work though.

2020-08-11 06 02 07

Perhaps instead of an actual show query text box on the main filter bar, it would make more sense to have a "preview query" button which launched an alert view (like the modal style alert view) with the query text and buttons to copy the SQL and execute the previewed filter string? Seems like a bigger text view would also make it easier to see the actual full SQL statement.

Nice!

I noticed in your screen grab, you're executing the query before pressing Show Query 鈥撀燼re you able to have the query update as you're adding and removing filters, similar to how the query shows and live-updates in the "Advanced Filter Content" panel? Or do you have it set up such that you have to execute the filter first, before you can see the query? I originally pictured the query text box being on its own row, above the row with the buttons, but I like how you put it inline on the buttons row to save space.

Re: text box vs. alert 鈥撀營 like having the query visible right there, without having to leave the current context, and I think it could be helpful for users who are learning SQL (if they've toggled "Show Query" on), if it can live-update as you add and remove filters. If it were me, even though I have a good amount of experience with SQL, I'd leave it on all the time. You make a good point that an alert view might provide a bigger area for the query, but I think having the query wrap and the text box grow downward would meet that need. You'd probably want to cap it at, say, 3 lines, but it would be rare for one of these filter queries to get that long. @jamesstout, is the text box able to grow downward with a long query? @Jason-Morcos, assuming the inline text box were able to expand downward, what other benefits do you see from having the query open in an alert/modal instead of being inline?

@Jason-Morcos, assuming the inline text box were able to expand downward, what other benefits do you see from having the query open in an alert/modal instead of being inline?

The big benefit I see is the ability to add additional capabilities like "copy filter query" or "export query as .SQL". It seems like adding an expanding textbook will further crowd the main table view. I think I would use the show query text feature as well, but I would use it to copy a query string to use somewhere else (in a project I'm working on or perhaps just to modify in the query editor manually - but I would have to toggle the query view visible, copy it over, then toggle invisible afterwards which seems annoying.
Additionally, real-time updating _sounds_ cool but that means another process running every time you type a character which seems to me to be distracting, kinda unnecessary, and potentially another source of lag.

toggle the query view visible, copy it over, then toggle invisible afterwards which seems annoying.

This is the exact annoyance I would have if it were an alert 鈥撀營 would have to click to open the alert, then copy, then close the alert. But if it's inline, it would just be there, and I could copy/paste it without toggling anything. :) If I have to go to another view, I may as well just use the console panel.

I don't think I would use an option to export a single query as SQL; mainly I'd be viewing and/or copying. I don't think a button for copying would provide much value either, as it's just as easy to Edit > Copy, right-click Copy, or 鈱楥. If this feature ends up being an alert, it wouldn't hurt to have those buttons, but I don't think see those as a strong enough argument to take the user to another view.

I agree that making sure it doesn't lag is important. If needed, maybe it would only update when you pause for a couple of seconds, or if the box you're typing in loses focus. And of course it wouldn't update if Show Query is toggled off.

Being a project owner, you have the tie-breaking vote, but I'm curious if anyone else following this thread has an opinion.

For this issue, I'll definitely yield to @jamesstout's wisdom haha. He's writing the code, whichever looks/feels/seems better to James is how we should move forward!

Nice!
I noticed in your screen grab, you're executing the query before pressing Show Query 鈥撀燼re you able to have the query update as you're adding and removing filters, similar to how the query shows and live-updates in the "Advanced Filter Content" panel?

Maybe ... I think the keys are captured already.

Or do you have it set up such that you have to execute the filter first, before you can see the query?

Can't remember .. I'll have to check the code again, but I think you have to filter first.

@jamesstout, is the text box able to grow downward with a long query?

Not at the moment, it was a quick POC, I didn't add all the constraints etc.

For this issue, I'll definitely yield to @jamesstout's wisdom haha. He's writing the code, whichever looks/feels/seems better to James is how we should move forward!

Wisdom 馃 ... I'm an iOS developer helping out where I can :)

I'll play around with it this weekend.

Maybe ... I think the keys are captured already.

No, they are captured on the custom query view, but not from the filter

Or do you have it set up such that you have to execute the filter first, before you can see the query?

Can't remember .. I'll have to check the code again, but I think you have to filter first.

Filter first.

I like this idea... it could even be a label that only gets updated when the filter is modified.

The big benefit I see is the ability to add additional capabilities like "copy filter query" or "export query as .SQL".

I was looking for Feature Requests for "Copy Filter Query" when I found this. Spot on. I want the ability to copy the filter query and paste it over in the Query window so I can refine it more (add GROUP BYs and maybe move columns around, etc). Export Query as .sql is a really great idea as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gms8994 picture gms8994  路  6Comments

robertoschwald picture robertoschwald  路  4Comments

stychos picture stychos  路  6Comments

SanderVanLeeuwen picture SanderVanLeeuwen  路  3Comments

lipatovroman picture lipatovroman  路  4Comments