dabernathy89 / vue-query-builder

A UI component for building complex queries with nested conditionals.
https://dabernathy89.github.io/vue-query-builder/
MIT License
641 stars 157 forks source link

sql or no-sql output #15

Open mojtabye opened 6 years ago

mojtabye commented 6 years ago

http://querybuilder.js.org has the ability to convert the output to mongo or SQL queries, do you have any plan to add this future?

dabernathy89 commented 6 years ago

Hey @mojtabye. I had a similar question in November:

https://github.com/dabernathy89/vue-query-builder/issues/12

I think a plugin system for formatting output here would be useful. However, I wouldn't want to duplicate work if it isn't necessary - i'll have to look and see what my options are here.

On that same note, I'd like to get a 1.0 version out this year, and that probably means looking pretty closely at the default output of the component. I wonder if it would useful to try to emulate the jQuery QueryBuilder output, since that looks pretty popular? And it could pair with their server-side libraries.

Final note: I am hesitant about adding a SQL output option, b/c I don't want to encourage folks to generate SQL on the front-end and then use it server-side. I get why it would be useful, though.

weedkiller commented 5 years ago

i would be interested in sql option and also how to integrate with asp

mattwmj commented 5 years ago

I did something similar at backend with java. IMHO vue-query-builder is a frontend component and should not output sql. Graphic QL may be?

margsk commented 5 years ago

I don't think the front-end should output sql but a package for the back-end to parse the front-end output into sql would be great.

dabernathy89 commented 4 years ago

Note to self - had an inquiry about an output option for Lucene queries.

andreas83 commented 4 years ago

Is there a Laravel/Eloquent rest endpoint implementation out there? if not, someone interested in creating one with me?

SQL Output i have to agree with @dabernathy89, creating sql on the frontend side can´t be the solution here. We don't want to send generated sql queries to the server, where most people will not sanitize the input. i.e. how would you make a prepared statement? you would need to parse the sql and replace the variables etc etc... this is stupid idea compared of having a structured (json) which is send to the server, where some helper lib will generate sql or call the orm directly.

update just found the example implementation for Laravel/Eloquent from @dabernathy89 (thx) https://github.com/dabernathy89/vue-query-builder-laravel-example

weedkiller commented 4 years ago

@dabernathy89 I really like your idea of a plugin system, so I could use SQL or Lucene output and allow others to enhance modify or work on it without impact.

dseeker commented 3 years ago

I'd like to second the use case of generating SQL entries. in our case, we are using a widget to generate a SQL command, but not to execute it, which is then saved as an entry into a query list that is fed to the backend configuration. so it's an internal tool, not a direct database query, which would not have the pitfalls of it.

If anyone know how I can take the object generated by this component and create an SQL query please let me know, maybe some other package?