I need to run SQL Queries with multiple conditions so I'm thinking if I'm able to store the conditions for each query in a JSON file I can run the JSON file and spit out the results object by object. Does anyone know of any libraries for Python that will take a JSON file and from that file build an SQL Query? I'm not looking to move JSON data into a database, but rather use the JSON objects as a means to build search criteria I want to run on a database.
For example assume my database table contains contact information such as First Name, Last Name, Street Address, City, State, Zip Code, Phone Number, Email Address, Marital Status, etc. If I wanted to have a query that would show results of people in my table that live in the states of NV, CA, and UT but do not have a marital status of single my JSON Object could contain something like the following:
{
"include": {
"State": {
"NV",
"CA",
"UT" }
"exclude": {
"Marital Status":"Single"
}
}
I'm open to other suggestions on how to accomplish this, but my goal is for users to be able to fill out some type of form of their search criteria and save that as a JSON object (or equivalent) and then go to my database and run those queries. It seems like something like this probably already exists. If it doesn't and others think it valuable cool!