AI in the SQL editor

The Editor runs ClickHouse SQL, and DataMind's AI, Kartlos, works with you in two ways: it suggests the next part of your query as you type, and it can write or repair a whole query for you. This page covers how both behave, so you know what to expect and when the AI stays quiet. The switch that turns suggestions on and off is on Write and check SQL.

Suggestions as you type

When you stop typing, the AI reads the query at your cursor and proposes how to continue. The suggestion appears after the cursor as grey ghost text; press Tab to insert it.

To see AI suggestions, your role needs one of these permissions: Execute Query, Add/Modify Lake Objects, Add/Modify Warehouse Objects or Add/Modify WriteBack Objects.

Writing and repairing queries

The same AI can produce a whole query, not only the next fragment. The query writer works in two modes:

Everything it writes is read-only. Nothing it writes changes data or the schema, and all of it is written in ClickHouse SQL, the same dialect the Editor runs.

The SQL it writes

Its SQL follows the Editor's conventions:

Questions, answered

What happens if the AI is not sure how to continue?

Nothing appears. The engine would rather suggest nothing than guess: a wrong identifier is worse than no suggestion.

Does a suggestion ever repeat the text I already typed?

No. It returns only the text that goes in at the cursor, so what you see is what gets added.

How long can a suggestion be?

Usually a single line. It can span several lines only inside a SELECT list.

Can the AI repair a query that fails?

Yes. In modification mode, the query writer alters the query you are working on. Like everything it writes, the result is read-only.

Does the AI write queries that change my data?

No. The writer produces read-only statements only; nothing it writes changes data or the schema.

Which SQL dialect does the AI write?

ClickHouse SQL, the same dialect the Editor runs; see Which SQL runs in the Editor.

Why does the AI write isEmpty() instead of IS NULL?

That is a house convention for SQL in the Editor, and the writer follows it: emptiness is checked with isEmpty() or isNotEmpty() rather than with IS NULL or IS NOT NULL.

Why does dot notation fail after an ARRAY JOIN?

After ARRAY JOIN over JSONExtractArrayRaw, a field cannot be reached with dot notation. Read it with JSONExtractString, JSONExtractInt or JSONExtractFloat instead.

How does the AI treat my {name:Type} parameters?

It leaves them in the query as written. A parameter reaches a query only through its {name:Type} text, so the writer keeps the placeholder and you fill the value on the Query parameters strip before you run.