Once the environment is configured, generate an endpoint and start the server.
Generate an Endpoint #
Introspect a table and generate its typed files with pull:
pnpm lakeql-cli pull --env .env@lakeql/cli as a dev dependency, so the
command runs the local binary by default. Toggle Run without installing on
any exec command to get the one-off form through pnpm dlx @lakeql/cli or
npx @lakeql/cli, which fetches the package for a single run.Run it interactively and it prompts for the source, schema, and table. You can also pass them as options. The generated files land under your configured source path. See Key Concepts for the layout.
Start the Server #
Start the generated dev script:
pnpm devThis runs the scaffolded dev script (node --env-file=.env --import tsx ./src/index.ts). The script loads the generated schema and serves GraphQL at /graphql, with a health check at /live.
Check that the server started. A request to /live succeeds, and the query below runs against your generated type. Exact response bodies depend on your data, so they are not asserted here.
Run a Query #
Open the GraphQL endpoint and run a query against your generated type:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
query {
orders(
sorting: [{ field: id, direction: ASC }]
paging: { page: 1, perPage: 10 }
) {
nodes {
id
status
}
pageInfo {
hasNext
currentPage
}
}
}
sorting is required on every generated query. It gives the engine a
deterministic ORDER BY. This keeps offset-based paging stable, so pages do
not repeat or skip rows. See Sorting &
Paging for why.
pull, or explore the guides.