Skip to main content

Queries — overview

A query in Liberty is a named SQL statement attached to a connector (which itself points at a pool, i.e. a database). Screens, dashboards, charts, dictionary lookups, dictionary sequences and the AI assistant all consume queries — so adding a query is the most common change you'll make in the Liberty Next pages.

The page that manages queries is Liberty Next → Data → Connectors. This overview maps it; the next pages walk through each "add" path.


The Connectors page at a glance​

Connectors+ ConnectorDiscardSaveReload config⌕ filter 4…APPS⛁crmsql · 3 table(s) · 6 query(ies)⛁salessql · 2 table(s) · 4 query(ies)DATA SOURCES◍erp_apiapi · 12 endpoint(s)⛁reportingsql · 9 query(ies)[connectors.crm] · sql+ Add queriesSETTINGSpool crmTABLES3 table(s)QUERIES3 query(ies)SEQUENCES1 sequence(s)LOOKUPS2 lookup(s)⌕ filter 3…customersCustomersGETPUTPOSDEL⧉dealsOpen dealsGETPUTPOSDEL⧉activitiesNotes and callsGETPUTPOSDEL⧉Click a table: the list narrows to a column and the table opens beside it.Apps and data sourcesgrouped by their menuWhat it holdstables, queries, endpointsPage buttonssave writes and reloadsFive stage cardseach with its countA table, four statementsread · update · insert · deleteClone the tableits four statements

Three regions:

RegionWhat it carries
Page headerGlobal actions — + Connector, Discard, Save, Reload config. Save writes the connector file and triggers a hot reload — no process restart needed.
Left listA filter and two groups: Apps (connectors that have a menu and are shown in the switcher — the apps users see) and Data sources (connectors that supply data but are not shown in the switcher). Each line says what the connector holds (sql · 3 table(s) · 6 query(ies)). Click a name to open it on the right.
Right paneThe editor for the selected connector. Five stage cards across the top, each with its count, pick a section — Settings, Tables, Queries, Sequences, Lookups.

The four kinds of queries​

A connector keeps its queries in four sections; the section a query sits in is its kind:

ViewWhat lives here
TablesOne entry per table, holding up to four queries: get (read), post (insert), put (update), delete. They are called <table>_get, <table>_post, <table>_put, <table>_delete. The list shows a row per table with its slot badges (GET / PUT / POS / DEL).
QueriesStandalone queries outside a table's set — reports, bulk operations, queries called by actions, charts or dashboards. Example: monthly_revenue, purge_old_logs.
SequencesQueries that return the next number for a dictionary sequence. Typical body: SELECT COALESCE(MAX(<col>), 0) + 1 FROM <table>.
LookupsQueries that return codes and labels for a dictionary lookup. Typical body: SELECT <value>, <label> FROM <table>.

A table, opened beside its list​

Opening a table, a query, a sequence or a lookup keeps the list beside it, narrowed to a column: one click goes to the next. The connector's sections fold to one line, and so do the table's stages — General (label and description), then Read, Update, Insert, Delete, each saying whether its statement is set, not set, or in orange not writable: refused at run time.

[connectors.crm] · sqlSETTINGSpool crmTABLES3 table(s)QUERIES3 query(ies)SEQUENCES1LOOKUPS2⌕ filter 3…customersCustomersdealsOpen dealsactivitiesNotes and calls← All tablescustomers· 4 slots filled↗ Open visual builder⑂✎⇄⇆⧉✕GENERALREADsetUPDATEsetINSERTsetDELETEsetShared metadata for this table (lives on the read query).LABELCustomersDESCRIPTIONPortfolio customersRead · Update · Insert · Delete open the statement of the table's _get, _put, _post, _delete query.Sections, foldedTables pickedThe list stays besideeach dot: one statementOne click to the nextdeals, activities…Table actionsusages, rename, clone, deleteFive stagesset · not set · not writableGenerallabel and description

Change type moves a query to another section — for example a query written under Queries that turns out to feed a lookup. When the move changes the query's name (a table slot becomes a standalone query, or the reverse), a warning lists the new name: screens, actions and dictionary entries that use the old name have to be updated.


The add buttons — one per view​

ViewButtonWhat opens
Tables+ Add queriesA choice: Generate from DB (the CRUD wizard — reads the table in the database and generates the four queries) or Empty stub (asks for a table name and creates an empty read query).
Queries+ Add queryA name prompt, then an empty query to fill in by hand.
Sequences+ Add sequenceThe scaffold — pick a table and a key column, see the SQL, save: it writes the query and the dictionary sequence.
Lookups+ Add lookupThe scaffold — pick a table, a value column, a label column and an optional filter, save: it writes the query and the dictionary lookup.

The next pages walk through each path.


What a query carries​

The query editor draws a query as three stage cards — What it is, Statement, Parameters — under a header with its name and its buttons:

StageFieldRequiredWhat it does
—Name (header)YesUnique inside the connector. The query's permission is sql:<connector>:<name>. Changed with Rename, which updates every reference.
What it isLabelNoShort name shown in lists.
What it isDescriptionNoWhat the query returns — shown under the name in the lists.
StatementSQLYesThe statement, with :name parameters. A single text, or one variant per database (default required) — see Per-dialect SQL.
StatementWritableNo (off)Off, only a SELECT is accepted. On for INSERT / UPDATE / DELETE / CALL.
ParametersParamsNoDeclared parameters, one line each: Name, Label, Default, Help, Example, Choices, Required — see Parameter binding.

The Statement card shows the first word of the statement and the databases it is written for, in orange when it is empty or writes without being marked writable; the Parameters card says how many are declared and which :placeholders the statement holds.


Save and reload — what a click does​

Saving on this page is atomic across two files when needed:

Action you tookWhat gets written
Created or edited a table or a queryThe connector file.
Used the scaffold for a sequence or a lookupThe connector file and the dictionary (the new sequence or lookup in the connector's scope).
Cloned a connector (whole app)A cross-file write that copies the dictionary overlay, screens, menu, charts and dashboards under the new name. Goes through a dedicated server route.
Renamed a connector, a query or a tableA cross-file update that touches every reference (screens, menus, dictionary, charts, dashboards). Refuses to run when local edits aren't saved.

After every save the framework runs a hot reload automatically. The new query is callable immediately — no restart, no logout.


What you actually do — quick map​

GoalRead
Generate the four CRUD queries from a real database table.Create from a database table — the wizard path, recommended when the table exists.
Write a custom query (standalone, hand-written).Create a custom query.
Make a copy of an existing query or of a whole application.Clone a query or a connector.
Add a sequence (next id) or a lookup (dropdown source).Sequences and lookups.
Pass values to a query — fixed values, other columns, the signed-in user.Parameter binding.
Ship different SQL for Postgres vs Oracle.Per-dialect SQL variants.

What's next​