Vex · API
createQueryEngine
createQueryEngine returns a query engine bound to a database adapter. introspect() loads the table schema from the adapter once; after that compile compiles a query to one SQL statement and lists the key each of its parameters is bound to. On this page nothing is executed and no model is called.
{
from: ['bookings', 'members'],
fields: [
{ field: 'members.name', as: 'name' },
{ field: 'bookings.seats', as: 'seats' },
],
filter: { eq: ['bookings.show_night', { $context: 'night' }] },
sort: [{ field: 'members.name', dir: 'asc' }],
}CREATE TABLE bookings ( id text PRIMARY KEY, show_night text NOT NULL REFERENCES shows(night), member_id text NOT NULL REFERENCES members(id), seats integer NOT NULL ) CREATE TABLE members (id text PRIMARY KEY, name text NOT NULL)
SELECT m1.name AS "name", b1.seats AS "seats" FROM bookings AS b1 JOIN members AS m1 ON b1.member_id = m1.id WHERE b1.show_night = $1 ORDER BY m1.name ASC LIMIT 100
[{ key: 'night', kind: 'context', type: 'string' }]Runs in this page on the installed package. The input and the expected output are defined by the example.