# US 2022/0292097 A1 · Continuous delivery of database queries for applications based on named and versioned parameterized database queries

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0292097 A1
- Document ID: US20220292097A1
- Status: Published application
- Kind: A1
- Application number: 17/199,232
- Filed: 2021-03-11
- Published: 2022-09-15
- Earliest claimed: 2021-03-11
- Assignees: Rockset, Inc.
- Applicants: Rockset, Inc.
- Inventors: Dhruba Borthakur; Venkat Venkataramani; Shruti Bhat; Scott William Morris; Aditi Dhar; Kshitij Wadhwa
- Web page: https://patentgrep.com/patent/US20220292097A1

## CPC

- G06F 16/24542: {Plan optimisation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system stores associates a database query with a name and stores versions of the database query. The system allows applications to execute a specific version of the database query by specifying the name of the database query and a version identifier. For example, the database query may be exposed as an endpoint of a REST API and invoked using calls to the REST API. This allows the applications to be designed without including the query definition within the code of the application. Continuous delivery of database query is performed by creating a new version of the database query that are tested using applications in a test environment. Once the new version of a database query meets test criteria, the new version of the database query is executed by applications running in production environment by sending API requests that identify the query name and the new version.

## Claims

### Claim 1

A computer-implemented method for upgrading database queries executed by applications, the method comprising:
storing a first version of a database query;
receiving from a production instance of an application, a first REST API request for executing the first version of database query, the first REST API request specifying the name of the database query, an identifier for the first version, and one or more parameters for the database query;
processing the first version of the database query in response to the first REST API request.
receiving a modification to the database query;
storing the modified database query as a second version of the database query;
receiving one or more REST API requests for testing the second version of the database query from one or more applications;
responsive to the second version of the database query passing a test criterion, promoting the second version of the database query for use with production instances of the application;
receiving a second REST API request from the production instance of the application, the second REST API request specifying the name of the database query, an identifier for the second version, and one or more parameters for the database query; and
processing the second version of the database query in response to receiving the second REST API request.

### Claim 2 (depends on 1)

The computer-implemented method of claim 1, further comprising
optimizing the second version of the database query before providing the second version of the database query as a REST end point.

### Claim 3 (depends on 2)

The computer-implemented method of claim 2, wherein optimizing the second version of the database query comprises:
generating statistics for tables processed by the second version of the database query; and
generating an execution plan for the second version of the database query, the execution plan optimized based on the generated statistics.

### Claim 4 (depends on 2)

The computer-implemented method of claim 2, wherein optimizing the second version of the database query comprises:
generating an index of a table processed by the second version of the database query; and
generating an execution query plan for the second version of the database query, the execution plan using the generated index.

### Claim 5 (depends on 1)

The computer-implemented method of claim 1, wherein each version of the database query provided as an endpoint of REST APIs is associated with a URL and the REST API request is sent as an HTTP protocol via the URL.

### Claim 6 (depends on 1)

The computer-implemented method of claim 1, wherein the application is a first application is based on a first programming language, the method further comprising:
receiving a third REST API request from a second application base on a second programming language, the third REST API request specifying the name of the database query and an identifier for the second version; and
processing the second version of the database query in response to receiving the third REST API request.

### Claim 7 (depends on 1)

The computer-implemented method of claim 1, further comprising:
responsive to receiving the modification to the database query, generating a version identifier for the second version of the database query; and
storing the second version of the database query in association with the generated version identifier, wherein the second version of the database query is identified by a REST API request by specifying the database query name and the generated version identifier.

### Claim 8 (depends on 7)

The computer-implemented method of claim 7, further comprising:
receiving a user defined tag for identifying the second version of the database query; and
storing the second version of the database query in association with the user defined tag, wherein the second version of the database query is identified by a REST API request by specifying the database query name and the user defined tag.

### Claim 9 (depends on 8)

The computer-implemented method of claim 8, further comprising:
storing a record for each version of the database query, the record including attributes comprising:
the database query name;
a generated identifier for a version of the database query;
a user defined tag for the database query; and
a query text including the query definition.

### Claim 10

A computer-implemented method for executing a parameterized query via REST APIs, the method comprising:
storing a plurality of versions of the parameterized database query, comprising:
receiving a modified definition of the parameterized database query; and
storing the modified parameterized database query as a new version of the parameterized database query in association with a value identifying the version;
providing one or more versions of the parameterized database query as endpoints for REST API requests;
receiving a REST API request from an application, the REST API request provided via a URL specifying
(1) a particular name of the database query,
(2) a particular value identifying a version, and
(3) one or more parameter values for the parameterized database query;
accessing a particular version of the database query based on matching of the particular name of the database query and the particular value identifying the version;
executing the particular version of the database query in response to receiving request the application using the one or more parameters specified by the REST API request.

### Claim 11 (depends on 10)

The computer-implemented method of claim 10, further comprising
optimizing a selected version of the database query before providing the selected version of the database query as a REST end point.

### Claim 12 (depends on 11)

The computer-implemented method of claim 11, wherein optimizing the selected version of the database query comprises:
generating statistics for tables processed by the selected version of the database query; and
generating an execution plan for the selected version of the database query, the execution plan optimized based on the generated statistics.

### Claim 13 (depends on 11)

The computer-implemented method of claim 11, wherein optimizing the selected version of the database query comprises:
generating an index of a table processed by the selected version of the database query; and
generating an execution query plan for the selected version of the database query, the execution plan using the generated index.

### Claim 14 (depends on 10)

The computer-implemented method of claim 10, wherein each version of the database query provided as an endpoint of REST APIs is associated with a URL and the REST API request is sent as an HTTP protocol via the URL.

### Claim 15 (depends on 10)

The computer-implemented method of claim 10, wherein the REST API request is a first REST API request, and wherein the application is a first application based on a first programming language, the method further comprising:
receiving a second REST API request from a second application based on a second programming language, the second REST API request specifying the name of the database query and an identifier for the particular version; and
processing the particular version of the database query in response to receiving the second REST API request.

### Claim 16 (depends on 11)

The computer-implemented method of claim 11, further comprising:
responsive to receiving the modified definition of the database query, generating a version identifier for the new version of the database query; and
storing the new version of the database query in association with the generated version identifier, wherein the new version of the database query is identified by a REST API request by specifying the database query name and the generated version identifier.

### Claim 17 (depends on 16)

The computer-implemented method of claim 16, further comprising:
receiving a user defined tag for identifying the new version of the database query; and
storing the new version of the database query in association with the user defined tag, wherein the new version of the database query is identified by a REST API request by specifying the database query name and the user defined tag.

### Claim 18 (depends on 18)

The computer-implemented method of claim 18, further comprising:
storing a record for each version of the database query, the record including attributes comprising:
the database query name;
a generated identifier for a version of the database query;
a user defined tag for the database query; and
a query text including the query definition.

### Claim 19

A computer system comprising:
one or more computer processors; and
a non-transitory computer readable storage medium storing instructions that when executed by the one or more computer processors, cause the one or more computer processors to perform steps comprising:
storing a first version of a database query;
receiving from a production instance of an application, a first REST API request for executing the first version of database query, the first REST API request specifying the name of the database query and an identifier for the first version;
processing the first version of the database query in response to the first REST API request.
receiving a modification to the database query;
storing the modified database query as a second version of the database query;
receiving one or more REST API requests for testing the second version of the database query from one or more applications;
responsive to the second version of the database query passing a test criterion, promoting the second version of the database query for use with production instances of the application;
receiving a second REST API request from the production instance of the application, the second REST API request specifying the name of the database query and an identifier for the second version; and
processing the second version of the database query in response to receiving the second REST API request.

### Claim 20 (depends on 19)

The computer system of claim 19, wherein each version of the database query provided as an endpoint of REST APIs is associated with a URL and the REST API request is sent as an HTTP protocol via the URL.
