Skip to content
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

Add support for specifying a custom SQL filter #1388

Closed
hugener opened this issue Aug 12, 2022 · 7 comments
Closed

Add support for specifying a custom SQL filter #1388

hugener opened this issue Aug 12, 2022 · 7 comments

Comments

@hugener
Copy link

hugener commented Aug 12, 2022

Is your feature request related to a problem? Please describe.
While analogy has some support for filtering log files with the predefined inputs like, Source, Text etc. and the UI controls also allows build more complex queries with the query builder. For me clicking a query together is more work that just writing a SQL query.
Being able to write the query by hand also has the advantage of creating a collection of query for analysis.
The predefined queries as I understand it are limited to certain fields like: Source, Text, Date etc.

Describe the solution you'd like
It would be nice to have the possibility to write a custom SQL statement for filtering. I imagine an additional text input in the filtering section that just passes the statement to underlying query.

Describe alternatives you've considered
I was trying to save a query created by the query builder

@LiorBanai
Copy link
Member

Hi @hugener . I can see the benefits for this.
do you think it may be better to add this feature under "advanced" mode since i average user won't use it?

Also I think we will also need validation and correctness of the SQL query since now it will be free text as input.

@hugener
Copy link
Author

hugener commented Aug 12, 2022

Hi @LiorBanai
Advanced mode sounds like a good idea.
Of course, validation and stuff like "intellisense" would be nice to have, but still secondary.
I think you are using DataView.RowFilter, but the documentation does not specify what the behavior is when invalid SQL is passed. Maybe there is an exception and it can simply be caught to show an error on the text input, informing the user that the SQL is invalid. For me that would suffice, since it is an advanced feature

@LiorBanai
Copy link
Member

LiorBanai commented Aug 12, 2022

yeah the simple way is to catch the exception but I'll look for more elegant way.

@LiorBanai
Copy link
Member

I have a working version that enables raw sql:
image

this is without auto complete for now but seems to work. it also show the last used filter so it can be modified further

LiorBanai added a commit that referenced this issue Aug 26, 2022
@hugener
Copy link
Author

hugener commented Aug 30, 2022

I gave it a try with the 4.9.0 release. It works well. Thanks!

@LiorBanai
Copy link
Member

good. there more improvements to made (store last X queries for example, auto complete... etc) but for initial option it can be use. Feel free to suggest improvements/changes :)

@LiorBanai
Copy link
Member

I'll close this one. Please reopen/submit new issue if there are problems :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants