16. A computer system including a processor and memory, wherein the computer system implements a database server comprising one or more processors and at least one memory, the database server configured to carry out operations comprising: receiving a first version of a database query including first query code in a declarative database query language, the first query code specifying at least first and second database operations; from the first query code, generating a second query code in an imperative language for the second database operation; embedding the second query code in a second version of the database query, the second version of the database query comprising a first parsable element for the declarative database query language code for the first database operation and a second parsable element comprising the imperative language code for the second database operation; executing the database query based on the second version of the database query at an execution engine of a database management system of the database server, the executing comprising: parsing the first parsable element of the second version of the database query and converting the first parsable element to an intermediate representation specifying one or more operations for retrieving information from one or more database records; and parsing the second parsable element of the second version of the database query and directly executing the imperative language code for the second database operation; returning results of the execution of the database query.
16. A computer system including a processor and memory, wherein the computer system implements a database server comprising one or more processors and at least one memory, the database server configured to carry out operations comprising: receiving a first version of a database query including first query code in a declarative database query language, the first query code specifying at least first and second database operations; from the first query code, generating a second query code in an imperative language for the second database operation; embedding the second query code in a second version of the database query, the second version of the database query comprising a first parsable element for the declarative database query language code for the first database operation and a second parsable element comprising the imperative language code for the second database operation; executing the database query based on the second version of the database query at an execution engine of a database management system of the database server, the executing comprising: parsing the first parsable element of the second version of the database query and converting the first parsable element to an intermediate representation specifying one or more operations for retrieving information from one or more database records; and parsing the second parsable element of the second version of the database query and directly executing the imperative language code for the second database operation; returning results of the execution of the database query. 17. The computer system of claim 16 , wherein the declarative language is a structured query language, wherein the imperative language is a scripting language, and wherein the second version of the database query specifies how to retrieve and transform data responsive to the database query.