Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SELECT FROM CATALOG

Synopsis

SELECT columns FROM CATALOG.table [ WHERE condition ] [ ORDER BY column [ ASC | DESC ] ] [ LIMIT n ]

Description

Executes a SQL query against the project metadata catalog. The catalog tables are populated by REFRESH CATALOG and can be queried using standard SQL syntax including joins, aggregations, subqueries, and filtering.

All catalog table names are prefixed with CATALOG. (e.g., CATALOG.ENTITIES, CATALOG.MICROFLOWS). The query engine is SQLite, so standard SQLite SQL syntax applies.

The following tables are available after a basic REFRESH CATALOG:

TableDescription
CATALOG.MODULESProject modules
CATALOG.ENTITIESEntities across all modules
CATALOG.ATTRIBUTESEntity attributes
CATALOG.ASSOCIATIONSAssociations between entities
CATALOG.MICROFLOWSMicroflows
CATALOG.NANOFLOWSNanoflows
CATALOG.PAGESPages
CATALOG.SNIPPETSSnippets
CATALOG.ENUMERATIONSEnumerations
CATALOG.WORKFLOWSWorkflows

The following tables require REFRESH CATALOG FULL:

TableDescription
CATALOG.ACTIVITIESIndividual microflow/nanoflow activities
CATALOG.WIDGETSWidget instances across pages and snippets
CATALOG.REFSCross-references between elements
CATALOG.PERMISSIONSAccess rules and role permissions
CATALOG.STRINGSAll string values in the project
CATALOG.SOURCESource text of microflows, pages, etc.

Parameters

columns
Column names or expressions to select. Use * for all columns, or specify individual column names. Supports SQL functions like COUNT(), SUM(), GROUP_CONCAT().
table
A catalog table name (e.g., ENTITIES, MICROFLOWS). Must be prefixed with CATALOG..
condition
A SQL WHERE clause for filtering rows. Supports standard operators (=, LIKE, IN, AND, OR) and subqueries.
column
Column to sort by. Append ASC (default) or DESC for sort direction.
n
Maximum number of rows to return.

Examples

List all entities

SELECT Name, Module FROM CATALOG.ENTITIES;

Find microflows in a specific module

SELECT Name FROM CATALOG.MICROFLOWS WHERE Module = 'Sales' ORDER BY Name;

Count entities per module

SELECT Module, COUNT(*) AS EntityCount
FROM CATALOG.ENTITIES
GROUP BY Module
ORDER BY EntityCount DESC;

Find entities with many attributes

SELECT e.Module, e.Name, COUNT(a.Name) AS AttrCount
FROM CATALOG.ENTITIES e
JOIN CATALOG.ATTRIBUTES a ON e.Id = a.EntityId
GROUP BY e.Module, e.Name
HAVING COUNT(a.Name) > 10
ORDER BY AttrCount DESC;

Find many-to-many associations

SELECT Name, ParentEntity, ChildEntity
FROM CATALOG.ASSOCIATIONS
WHERE Type = 'ReferenceSet';

Find pages with no microflow references

SELECT p.Module, p.Name
FROM CATALOG.PAGES p
WHERE p.Id NOT IN (
  SELECT DISTINCT TargetId FROM CATALOG.REFS WHERE RefKind = 'page'
);

Limit results

SELECT Name FROM CATALOG.MICROFLOWS LIMIT 10;

See Also

REFRESH CATALOG, SHOW CATALOG TABLES, SEARCH