New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to modify SQL query from a filtered view #61

Closed
adampope opened this Issue Sep 4, 2015 · 10 comments

Comments

Projects
None yet
4 participants
@adampope

adampope commented Sep 4, 2015

I'm viewing a table, I might have applied a filter now I want to do something more complex (a join, an aggregation etc) I'm looking for a way to see and edit the SQL query for the current view. At the moment I have to go to the SQL Query view and type the whole query out, which isn't very productive, especially with long table names.

@jakob jakob added the enhancement label Sep 28, 2015

@diffen

This comment has been minimized.

Show comment
Hide comment
@diffen

diffen Dec 23, 2015

I came here to request this feature too 👍
This can be a button next to "Save Filter..." and "Load Filter...". Perhaps call it "SQLize Filter..." and clicking on that button opens a modal/popup with the SQL query for the current filter.

diffen commented Dec 23, 2015

I came here to request this feature too 👍
This can be a button next to "Save Filter..." and "Load Filter...". Perhaps call it "SQLize Filter..." and clicking on that button opens a modal/popup with the SQL query for the current filter.

@barrywoolgar

This comment has been minimized.

Show comment
Hide comment
@barrywoolgar

barrywoolgar Jun 3, 2016

I'd like this feature too, as I often want to do something simple like add a secondary sort column (a poor mans #137, if you will). Thanks for a great tool btw.

barrywoolgar commented Jun 3, 2016

I'd like this feature too, as I often want to do something simple like add a secondary sort column (a poor mans #137, if you will). Thanks for a great tool btw.

@barrywoolgar

This comment has been minimized.

Show comment
Hide comment
@barrywoolgar

barrywoolgar Mar 28, 2017

Hello, I'm still using Postico daily, and missing this feature almost as often. Please can we have a simple 'edit filter' button that switches to the SQL query view with the filter query loaded?

barrywoolgar commented Mar 28, 2017

Hello, I'm still using Postico daily, and missing this feature almost as often. Please can we have a simple 'edit filter' button that switches to the SQL query view with the filter query loaded?

@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Mar 28, 2017

Owner

I think it would be convenient to have an 'SQL Preview' button, which I already have in other parts of the UI, and maybe add an 'open in SQL query view' option.

Owner

jakob commented Mar 28, 2017

I think it would be convenient to have an 'SQL Preview' button, which I already have in other parts of the UI, and maybe add an 'open in SQL query view' option.

@barrywoolgar

This comment has been minimized.

Show comment
Hide comment
@barrywoolgar

barrywoolgar Mar 28, 2017

Maybe, but that makes it two steps to get to some editable SQL. On it's own, would the preview of the standard filter SQL be much use? The UI already does a good show of showing what the filters are, because of their simplicity.

Also, I'd worry that you would want UI consistency with the 'SQL Preview' button appearing in the yellow bar at the bottom, which would be quite far from the filters I've just set at the top (unrelated, but it's a pet peeve that the filters are at the top, but the filter toggle is at the bottom).

Thanks for taking the time to respond!

barrywoolgar commented Mar 28, 2017

Maybe, but that makes it two steps to get to some editable SQL. On it's own, would the preview of the standard filter SQL be much use? The UI already does a good show of showing what the filters are, because of their simplicity.

Also, I'd worry that you would want UI consistency with the 'SQL Preview' button appearing in the yellow bar at the bottom, which would be quite far from the filters I've just set at the top (unrelated, but it's a pet peeve that the filters are at the top, but the filter toggle is at the bottom).

Thanks for taking the time to respond!

@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Mar 28, 2017

Owner

The filters need their own SQL Preview button (since the SQL is different to the SQL shown in the yellow save bar).

I understand your concern about the extra click. Let me try implementing it, and once we can try it we'll see how much of a hassle it really is.

Coherence in the UI is important for me. Ideally, every bit of UI that generates SQL should have a way to show a preview, and to copy the SQL to the SQL query view. And this should work the same everywhere...

(PS: I agree with your annoyance that the filter bar is at the top. We're planning to move the filter bar back to the bottom in version 1.2 because at the top it interferes with a different feature we're working on)

Owner

jakob commented Mar 28, 2017

The filters need their own SQL Preview button (since the SQL is different to the SQL shown in the yellow save bar).

I understand your concern about the extra click. Let me try implementing it, and once we can try it we'll see how much of a hassle it really is.

Coherence in the UI is important for me. Ideally, every bit of UI that generates SQL should have a way to show a preview, and to copy the SQL to the SQL query view. And this should work the same everywhere...

(PS: I agree with your annoyance that the filter bar is at the top. We're planning to move the filter bar back to the bottom in version 1.2 because at the top it interferes with a different feature we're working on)

@jakob jakob added this to the v1.1.3 milestone Mar 28, 2017

@barrywoolgar

This comment has been minimized.

Show comment
Hide comment
@barrywoolgar

barrywoolgar Mar 28, 2017

Much appreciated, I totally understand your points. I'm just focused on this issue, whereas you've got the whole app to deal with, so I'm very happy to wait and see.

(PS: To clarify my annoyance, it's with the filter button being at the bottom ;) Happy to wait and see on that one too!)

barrywoolgar commented Mar 28, 2017

Much appreciated, I totally understand your points. I'm just focused on this issue, whereas you've got the whole app to deal with, so I'm very happy to wait and see.

(PS: To clarify my annoyance, it's with the filter button being at the bottom ;) Happy to wait and see on that one too!)

@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Jul 17, 2017

Owner

I've now added an "SQL Preview" button to the filter bar. Clicking it shows the SQL generated by the filter in a popover.

Download build 1706 to try it: https://eggerapps.at/postico/builds/

Owner

jakob commented Jul 17, 2017

I've now added an "SQL Preview" button to the filter bar. Clicking it shows the SQL generated by the filter in a popover.

Download build 1706 to try it: https://eggerapps.at/postico/builds/

@barrywoolgar

This comment has been minimized.

Show comment
Hide comment
@barrywoolgar

barrywoolgar Jul 18, 2017

Thanks for sharing this, it will certainly be helpful. Is it still the plan to extend this into a one-click copy/paste into the SQL view at some point?

I appreciate there's probably a good reason for listing the columns names individually, but would it be possible for this preview to use tablename.*? When using this on a table with a lot of columns (too many!) the SQL is obviously quite verbose, and without multi-line formatting in the preview popover it takes a little longer to make it manageable when editing.

This is a tiny concern, and having a list of column names in the SQL view for reference could actually be useful, so I'm undecided about whether this is even a problem.

Thanks again

barrywoolgar commented Jul 18, 2017

Thanks for sharing this, it will certainly be helpful. Is it still the plan to extend this into a one-click copy/paste into the SQL view at some point?

I appreciate there's probably a good reason for listing the columns names individually, but would it be possible for this preview to use tablename.*? When using this on a table with a lot of columns (too many!) the SQL is obviously quite verbose, and without multi-line formatting in the preview popover it takes a little longer to make it manageable when editing.

This is a tiny concern, and having a list of column names in the SQL view for reference could actually be useful, so I'm undecided about whether this is even a problem.

Thanks again

@jakob

This comment has been minimized.

Show comment
Hide comment
@jakob

jakob Jul 18, 2017

Owner

The one-click-open-in-SQL view isn't all that trivial, since I'm not sure what should be done with the potentially existing text in the SQL View. I'll rather leave it like it is.

You are right that the formatting isn't perfect -- at some point I should properly format that query. I haven't done that yet, because until now there was no way to view this query :)

There is a full column list instead of * because this is the same query Postico uses to fetch results. Postico needs to provide the full list to make sure query results return the expected columns. If someone changed the table structure in the mean time, Postico might receive unexpected columns and odd things might happen.

Thanks for your comments!

Owner

jakob commented Jul 18, 2017

The one-click-open-in-SQL view isn't all that trivial, since I'm not sure what should be done with the potentially existing text in the SQL View. I'll rather leave it like it is.

You are right that the formatting isn't perfect -- at some point I should properly format that query. I haven't done that yet, because until now there was no way to view this query :)

There is a full column list instead of * because this is the same query Postico uses to fetch results. Postico needs to provide the full list to make sure query results return the expected columns. If someone changed the table structure in the mean time, Postico might receive unexpected columns and odd things might happen.

Thanks for your comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment