Ask HN: SQL Query Generators?
I have spent hours looking into ORMs and I dont think they provide the functionality I require?
The goal would be to have one function call where param1 is the SELECT fields, and param2 is the WHERE fields+filters. From there, it essentially builds the FROM statement with all the JOINs and ON statements (as well as the SELECT/WHERE). If I pass five SELECT fields from five different tables, the code should figure out how to JOIN all the tables together. If I pass a field in the WHERE param, it should figure out if it that table needs to be JOINed as well. I have also built in an option to 'LEFT OUTER JOIN' the SELECT and WHERE fields such that any table in the WHERE fields that is not in the SELECT fields is excluded from the JOINs, which reduces code customization for my purposes.
I have built my own library to do what I want, and it works, but I know I have not covered all edge cases. I'd like to replace it with something that has been battle tested.