主权项 |
1. A method for generating database queries from declarative queries having a known syntax comprising:
receiving, by one or more processors, a set of JavaScript Object Notation (JSON) query statements and an identification of a target database that supports Structured Query Language (SQL) queries; analyzing, by one or more processors, the set of JSON query statements to build a first set of generic language-independent query tasks with identified data types, wherein fields in the set of JSON query statements map to attributes in the first set of generic language-independent query tasks; optimizing, by one or more processors, the first set of generic language-independent query tasks by performing one or more of: adding tasks, re-arranging tasks, and combining subsets of tasks; building, by one or more processors, a first target database query from the optimized first set of generic language-independent query tasks reflecting features of the target database; submitting, by one or more processors, the first target database query to the target database; receiving, by one or more processors, a declarative query that does not include a set of JSON query statements; analyzing, by one or more processors, the declarative query to build a second set of language-independent generic query tasks with identified data types, wherein fields in the declarative query map to attributes in the second set of language-independent generic query tasks; optimizing, by one or more processors, the second set of generic query tasks by performing one or more of: adding tasks, re-arranging tasks, and combining subsets of tasks; building, by one or more processors, a second target database query from the optimized second set of language-independent generic query tasks reflecting features of the target database; submitting, by one or more processors, the second target database query to the target database; and providing, by one or more processors, a user with an interface for adjusting specific features and/or properties in order to customize generation of subsequent target database queries. |