The Queries step holds the SQL that fills a Dictionary. Each source system gets one query, and each source system can be used once per dictionary. Use the step to write the query, check that it returns a Source ID column, fix a failing query with AI, and go back to an earlier version. The other steps are on Dictionary general settings, Define table columns and Dictionary data mapping.
The step shows the Data Sources panel on the left and the SQL editor on the right.
The window shows "No source systems available" when there are no source systems to pick, and a line with "No sources match" and your search text when a search finds nothing. Once a source is selected, a summary confirms your choice and a notice repeats the rule: "Each data source can only be used once across all queries." When every source system is taken, the window warns: "All available data sources are already in use. Each data source can only be used once." To use another source system, create it first, as described on Semantic sources, source systems and logical models.
The step starts empty: the panel reads "No sources yet" and the editor area reads "No query selected" until you add a query.
Each query in the panel carries a status badge: Validated, Needs fix (it has SQL and a source system but has not passed), or Draft (it has no SQL yet). The open query also shows Validated or Not validated in the editor header. Editing the SQL clears the validated state, so validate again before you save; if you put the text back exactly as it was saved, its saved state returns.
Validation runs three checks on your query before it is sent, in this order:
select; capital letters are ignored.| Message | What to do |
|---|---|
| Query cannot be empty | Write a query. |
| Query must be a SELECT statement | Write the query as a SELECT. |
| Query must include "Source ID" field (exact match required) | Return a column named exactly Source ID. |
| Error validating query | The check did not go through. Try again. |
The result is checked on the server as well; the rules and their messages are on Dictionaries.
If the dictionary is not saved yet, the fix is refused: a Cannot fix query toast says "Save the dictionary first, then try Fix with AI again." If no corrected query comes back, a Fix with AI failed toast appears, with the reason or "Failed to generate a fixed query"; edit the SQL yourself or try again.
History in the editor header (tooltip Query history) opens the saved versions of the query. The button appears when the dictionary is saved and the query has a source system.
The Query guidelines button at the bottom of the panel opens Query Guidelines, the rules for writing dictionary SQL queries:
The footer reads "Ctrl+Enter to validate quickly"; click Got it to close the window.
Hover a row in the Data Sources panel and click the remove button that appears. A query you added in this session disappears from the list straight away; a query that was already saved is marked for deletion and is removed when you save the step. A step with no queries is refused both on save and on the way out; the messages are in the section below.
Click Apply to save the step once it has changes, or move on with Next; Revert discards the unsaved changes.
It needs a query with text and a source system. It is disabled when the editor is empty, when no source system is chosen, while a check is already running, and once the query is validated. Edit the SQL to make it available again.
Validated means the query passed its checks. Needs fix means it has SQL and a source system but has not passed. Draft means it has no SQL yet. The editor header shows the open query as Validated or Not validated.
Yes. Any change to the SQL clears the state, and the query must be validated again before saving. If you restore the text exactly as it was saved, the saved state comes back.
No. Each source system can be used once per dictionary. A source that already has a query appears with an In use badge in the picker, and when every source is taken, Add Data Source is disabled: "All available data sources are already in use. Each data source can only be used once." To add another query, create another source system first; see Semantic sources, source systems and logical models.
Write the merge with UNION DISTINCT, as the Combining data guideline asks; that keeps one row per value. Every query must still return the same field count and names as the dictionary's other queries.
It still counts as validated: the query ran and returned nothing. The preview shows No data available and says "This query executed successfully but did not return any rows." Change the SQL if you expected rows, then validate again.
Because the dictionary is not saved yet. The fix is refused with Cannot fix query: "Save the dictionary first, then try Fix with AI again." Save the dictionary, then open the query and try again.
Yes, when the query has saved versions: open History in the editor header, pick a version, and click Replace. The editor takes that SQL back, and the validated state clears, so validate before you save. Compare shows the version against the current query first.
Hover its row in the Data Sources panel and click the remove button. A query added in this session vanishes from the list; a saved query is removed when you save the step.
The step needs at least one data source, and every query must be validated. Otherwise it refuses with a Validation Error that names the check: "Please add at least one data source before proceeding" or "Please validate all queries before proceeding".