SQLDesk

Administration

Everything an administrator does, and where to look when something is wrong.

Users and groups

Groups carry permission. A user in the admin group can do everything; the default group is what everyone else starts in. Data sources are attached to groups, so adding somebody to a group is how they get access to data.

Users can be disabled rather than deleted, which keeps their queries and dashboards intact and attributed. Disable user, at the top of their page or on the users list, is the kill switch for an account, and asks first. At once: they are signed out everywhere and cannot sign in, by password or single sign-on; their API key stops working; the AI apps they connected are disconnected; dashboard emails they set up stop; and queries and notebook cells they have running or waiting are stopped. Scheduled refreshes go on, since they keep other people’s dashboards current. Disabling and enabling are in the audit log. Nobody can disable themselves: the button is greyed out on your own page, and another admin can.

Email addresses are for admins. An admin sees everyone’s; everybody else sees only their own. Anywhere another person appears — their profile, the users list, a group’s members, a dashboard’s owner, an alert’s subscribers — a member sees their name.

The Admin pages

Admin in the top row, for anyone with super_admin. Each page says what it is for in a line or two under its tabs, so you are not guessing which of seven holds the number you want.

Overview
Where the headroom is going: Postgres connections, Redis memory, how many workers are busy, how deep the queues are. Also who has run the most queries in the last hour and how much of that came from cache. The place to start when the instance feels slow and you do not yet know why.
System Status
The server's report on itself — version, uptime, when the query manager last made a pass, queue depths, table sizes. The figures to quote when something has to be escalated.
RQ Status
The job queues themselves, worker by worker. A queue growing while workers sit idle means the jobs are going somewhere nobody is listening.
Storage Status
What is being held and what happens to it when: cached query results, uploaded files, and how much of its quota each organisation has left. Both clean-ups can be started from here rather than waiting for their slot. See What happens to uploaded files.
Running Queries
Everything the workers have in flight, who asked for it, against which data source and for how long. A scheduled refresh shows as the scheduler rather than a person, because nobody is waiting for it. Any of them can be stopped from here, and stopping one is recorded.
Streaming Queries
Every Kafka topic being consumed, the rate events are arriving at, and — the column it exists for — why a quiet one is quiet. Paused, broken and genuinely empty look identical on a chart and are three different problems. The row budget and the events-per-second ceiling are set here. Shown when streams are on.
Outdated Queries
Scheduled queries whose next run is already overdue. A handful is ordinary; a long list means the workers are not keeping up with the schedules people have set.
MCP
Who has connected over MCP, what they asked for, and every refused attempt — never the question somebody put to their client and never the SQL that came back. A write records what it changed, before and after, because "update_table ok" does not answer the question anybody brings to an audit of an agent's writes. Shown when MCP is on. See MCP.

Reviewing what an agent wrote

An agent pointed at the catalog can describe a warehouse in an afternoon — that is the point of letting it — and that is also why a badge here and there among three thousand tables is not a review. Catalog has a Written by an agent filter that answers exactly that question, and each description carries the name on the API key that wrote it, not merely the fact that a machine did.

Two things an agent cannot do, deliberately:

Every write is capped at fifty a day per person (SQLDESK_MCP_WRITES_PER_DAY). An agent told to describe a warehouse will describe the whole warehouse, and a loop getting it wrong will do it just as fast; fifty keeps a mistake to a morning's review rather than a restore.

Settings is its own menu in the top row rather than a gear on the right, and it holds different things for different people: an administrator sees data sources, users, groups, alert destinations and the organisation's settings; everybody else sees their snippets and their own account.

Permissions an administrator hands out

Some things are neither for everybody nor only for administrators. The person who knows what a table is for is rarely the person who runs the cluster, so these are granted to a group, under Settings → Groups, and anyone in that group has them.

PermissionWhat it allowsOffered when
manage_catalogDescribe tables and columns, agree or deny proposed measures, export the semantic layer. Puts Catalog in the top row.MCP is on
use_streamsStart a stream and watch it. Starting one takes a slot; watching somebody else's running stream needs no permission at all.Streams are on
manage_streamsChoose which of a cluster's topics may be queried, and how much of each is kept. Puts Streaming Data Sources beside Data Sources in Settings.Streams are on
use_notebooksChain SQL and Python cells together, where a saved query ends in one SELECT. Puts Notebooks in the top row. Python cells additionally need an interpreter, which is a deployment decision rather than a permission.Always
manage_live_dashboardsMake a dashboard live, so the server refreshes it for everyone looking.Always
keep_uploadsStop an uploaded file expiring, so it stays until somebody deletes it.Files expire at all
use_mcpConnect a client over MCP, and see what yours has been doing under My MCP.MCP is on
send_dashboardsSubscribe people to a dashboard on a schedule, and send one to Slack.Rendering is on

A permission this install cannot honour is not offered at all, rather than granted and inert. With streams switched off in the chart there is no streams permission to give anybody, and with MCP off there is no catalog permission — because a permission that does nothing is worse than no permission.

What happens to uploaded files

An uploaded file is the only copy there is. A query result can be fetched from the warehouse again; a CSV somebody dragged in six months ago and has since deleted from their laptop cannot be re-created by anybody. So the policy is deliberately cautious, and nothing is ever deleted without a warning somebody could have acted on.

  1. Three days unqueried: unloaded. The file stops being registered with DuckDB, so queries on that data source no longer pay to infer its schema. The file is untouched and the next query that names it brings it back. Nobody is told, because nothing was lost.
  2. Six days: its uploader is emailed — one message, however many of their files are due, each with its size, whether it has ever been queried, and a button that keeps it.
  3. Seven days: deleted, but only files that were warned about. If mail was not working, nothing is deleted; the warning is retried instead. A file whose uploader has no address is never deleted on a timer at all — an administrator removes it from the Storage page, having looked at it.

Keeping a file is a permission (Keep uploaded files) an administrator grants to a group, from the email, the Storage page, or the data source's own page. A kept file stays until somebody deletes it.

The quota is a ceiling on everything uploaded, 5 GB by default. An upload past it is refused with the figures in the message, including how many files nothing has queried in a month — removing those is almost always the answer.

Turn any of it off with SQLDESK_UPLOAD_LIFETIME_DAYS=0, SQLDESK_UPLOAD_UNLOAD_AFTER_DAYS=0 or SQLDESK_UPLOAD_QUOTA_MB=0. The reason the default is not "keep everything" is that keeping everything is what SQLDesk did until 0.7, and on a development machine it filled the disk and took Postgres with it.

Keeping it healthy

Settings worth knowing

SettingWhy
SQLDESK_SECRET_KEYEncrypts data source credentials. Rotating it makes them unreadable.
SQLDESK_HOSTThe address in emails and alerts. Wrong, and every link points at localhost.
SQLDESK_FEATURE_AITurns MCP on. Off by default.
Mail settingsWithout them, alerts and invitations silently do nothing.
Public URLsCan be disabled instance-wide if shared links are not acceptable.
SQLDESK_UPLOAD_QUOTA_MBA ceiling on uploaded files, 5 GB by default. 0 removes it, and removing it is how a disk fills.
SQLDESK_UPLOAD_LIFETIME_DAYSHow long an uploaded file is kept, 7 by default. 0 keeps everything forever.
SQLDESK_STREAM_ROW_BUDGETRows of raw events kept per stream, 5 million by default. The window follows from this and the rate.
SQLDESK_STREAM_EVENTS_PER_SECONDEvents a second stored from one stream, 5,000 by default. Past it they are sampled and every chart says so. 0 removes the ceiling, which is how a worker becomes the slowest part of a cluster.
SQLDESK_STREAM_ACTIVE_MINUTESHow long after somebody last looked a stream keeps consuming, 15 by default. 0 turns streams off entirely.
SQLDESK_METRICS_TOKENA bearer token a Prometheus scraper shows at /metrics. Empty — the default — means the endpoint is not mounted at all. See below.
SQLDESK_NOTEBOOK_EXECUTOR_URLWhere the interpreter for Python cells is. Empty means Python cells say so rather than running.
SQLDESK_NOTEBOOK_EXECUTOR_TOKENWhat SQLDesk shows that interpreter. Both sides must match.
SQLDESK_NOTEBOOK_SCALA_ROWSThe most rows an earlier cell sends to a Scala cell, and a Scala cell brings back, 10,000 by default. SQLDESK_NOTEBOOK_LIVY_ROWS, its old name, is still read.
SQLDESK_QUERY_ESTIMATE_WAIT_SECONDSHow long the editor waits for an estimate before saying there is none, 20 by default.
SQLDESK_DUCKDB_STORAGE_COMPATIBILITYThe storage format DuckDB writes, v1.5.0 by default so a stream window or uploaded database stays readable by 0.7.x. latest takes the newer format and makes going back a one-way door. See below.

Scraping SQLDesk

Set SQLDESK_METRICS_TOKEN and /metrics answers a scraper that shows it as a bearer token. Unset — the default — the endpoint is not mounted, and a wrong token gets the same 404 as no token: which half was wrong is not a scanner’s business.

What it reports is what SQLDesk is about to run out of, read at the moment of the scrape rather than accumulated:

Two things worth knowing when you build a dashboard on it. The database numbers describe the process that answered, because a SQLAlchemy pool is per process — with several web workers the useful view is the maximum across them. And a pool with no limit has no _limit series rather than a zero, because a zero there would read as “no room at all”, which is its opposite.

A scrape that cannot read one source still returns the others: during an incident, half the truth is worth more than an error page.

Upgrading to 0.8: the DuckDB file format

0.8 ships DuckDB 2.0, and DuckDB 2.0 writes a database file that DuckDB 1.5.6 — what 0.7.x shipped — refuses to open. That matters in exactly one place: the files SQLDesk writes for itself, which are stream windows and any uploaded database.

By default it does not matter at all, because SQLDESK_DUCKDB_STORAGE_COMPATIBILITY is set to v1.5.0 and those files keep the older format. Upgrade, decide you preferred 0.7.10, and go back: everything still opens.

Two things are worth knowing either way:

Set it to latest if this install is never going back, and you get whatever 2.0 improved about the format. It is a one-way door from the moment you do.

One change you may see in a query

DuckDB 2.0 made a new SQL parser the default, and that parser refuses the single-arrow lambda every earlier version accepted:

-- refused by DuckDB 2.0 on its own
SELECT list_transform(items, x -> x * 2) FROM events;

-- the current spelling
SELECT list_transform(items, lambda x: x * 2) FROM events;

SQLDesk re-enables the old spelling on every DuckDB connection it opens, so a query that ran in 0.7.10 still runs. That is a reprieve, not a fix — DuckDB removes both the syntax and the flag that re-enables it in 2.1, so a query using the single arrow should be changed now rather than when it breaks.

One other difference shows up in stream windows: a timestamp field now lands as TIMESTAMP WITH TIME ZONE where it used to land as a naive TIMESTAMP. That is the more correct reading — the offset was previously being dropped — and windows created before the upgrade keep the column they already have.

Query pools: capping what a warehouse is given

How many queries run at once has always been an accident of deployment: the number of worker processes times the number of replicas. The only way to change what a warehouse is subjected to was to change the deployment — and an autoscaler moving replicas while a query runs changed it again without anybody asking.

A pool is a ceiling that does not move when the workers do. It is held in Redis, which every worker already shares, and is checked at the moment a query begins.

The budget belongs to the pool rather than to SQLDesk, because the warehouse is what falls over, not us — a single number for the whole install would be the same figure for a Postgres toy and a Snowflake bill.

A pool is counted in slots: a query takes one while it runs. With 8 slots, at most 8 queries run on that warehouse at once; a ninth waits a few seconds for one to finish, then is refused with a sentence naming the pool and the numbers, rather than piling onto the warehouse.

Every data source draws from a pool of its own. Two data sources on one machine should share a pool — prod-readonly and prod-analytics are two rows here and one warehouse, and capping each at eight hands that warehouse sixteen. A pool need not be a database: a rate-limited HTTP connector is the same kind of scarce.

Nothing about a pool needs a redeploy. Everything below is set in the app.

Turning pools on, and the default size

Shared pools

Made on Admin → Query Pools with New shared pool, at the top of the pools: a name and a size. Then choose it under Query pool on each data source’s page; the sources in it share its slots. A pool is a row as soon as it is made, before any data source joins it. Select its row to resize it or delete it: the confirmation names the data sources in it, which go back to pools of their own. A data source can only choose a pool that has been made, so a typo cannot quietly become a pool of its own. A data source’s own pool is not deleted but switched off: Turn the limit off, beside its size.

A size of 0 stops a pool, which is the kill switch for a warehouse in trouble: the data sources keep their queries, dashboards, schema and permissions, and simply stop being given anything to do. Queries already running finish; anything new, notebook cells included, is refused at once with a sentence saying so, and the pool’s page shows it as stopped. The same goes for a data source’s own Slots set to 0.

How a pool is shared

Each kind of work is guaranteed a share of every pool, and any free slot can be used by whoever asks, in priority order: people first, then scheduled refreshes, notebooks and AI clients. The one rule: a query never takes a slot still guaranteed to a kind above it. People can use what schedules are guaranteed while schedules are quiet; an AI client never uses what people are guaranteed. Nothing already running is stopped — which is why that rule is what keeps a guarantee.

Each pool has its own: select a pool on Admin → Query Pools and its sharing is the section under the pools, together at most 100%, with what each kind always gets and can reach in slots; the rest goes to whoever asks first. A pool nobody has changed is shared the default way, below, and Use the default puts one back. In a pool of 8, the defaults give:

PriorityGuaranteedIn a pool of 8
1. People50%always 4, up to all 8 when free
2. Scheduled refreshes25%always 2, up to 4 when free
3. Notebooks10%nothing held back (10% of 8 rounds down), up to 2
4. AI clients0%nothing held back, up to 2

So a burst of refreshes cannot crowd out a dashboard, and an agent only uses capacity nobody above it needs. Give a pool meant for agents a guarantee for AI clients, and they always have it there.

Set by the deployment

For installs configured as code, the same things can be set in the environment. Pools set this way show on Admin → Query Pools as set by the deployment and cannot be changed in the app.

SettingWhat it does
SQLDESK_QUERY_POOLSShared pools and their sizes, as name=slots pairs, for example warehouse=8,vendor-api=2. 0 stops that pool.
SQLDESK_QUERY_SLOTS_DEFAULTOnly for data sources never switched on or off, from before the switch: what their pool is worth. 0, unlimited, by default, so upgrading caps nothing.
SQLDESK_QUERY_POOL_SHARESHow every pool is shared, as kind=always:up-to percentages, for example interactive=50:100,mcp=0:25.
SQLDESK_QUERY_SLOT_WAIT_SECONDSHow long a query waits for room before giving up and saying so (10). Short on purpose: a worker waiting is a worker doing nothing.
SQLDESK_QUERY_SLOT_TTL_SECONDSHow long a slot survives unrenewed. A running query renews its own; this is what frees the slot when a worker is killed.

On the data source’s page

The page is in cards: the connection, who can query, the queues, the query pool, and cost and usage, with a list of them down the left. One Save changes, at the top beside Test connection and Pause, saves all of them. On the right, Right now shows what the source’s pool holds and its last hour, for a pool that is on; a pool that is off records nothing, so there is nothing to show.

The pool and cost settings, each with an ⓘ that says what it means:

Cost and usage is on every data source: your prices first, then what to do with them. What the engine cannot do is shown switched off, with the reason, rather than hidden (which engines report what).

Under the pool’s settings, how its slots are shared, as set for every pool.

Admin → Query Pools

Every pool with a limit, as a row: what is in use now against its size, split by kind of work, how many queries it refused in the last hour, and whether it is OK, busy, full or stopped. Pools with no limit record nothing, so they are listed by name on one line. New shared pool, at the top, makes a shared pool.

Select a row and how that pool is shared opens under the pools. The right side shows its Size, changed in place for a source’s own pool or a shared pool made here, with Delete pool or Turn the limit off; its last 60 minutes, a line for each kind of work against the limit with the minutes that refused a query marked; and who holds a slot now: whose query, what kind and the job.

It refreshes every five seconds and reads Redis only. The hour costs no more than that: the scheduler takes one sample of each pool used this hour once a minute, and a refused query adds one to a counter that expires after the hour.

Admin → Overview

What runs out first, what needs doing, and the last hour.

The gauges come from Redis every ten seconds. Postgres connections, table sizes and the hour, which are what cost Postgres anything, are read once a minute. What is running now is the Running queries tab.

Streams, operationally

What a stream costs is different in kind from everything else here: a query costs when somebody runs it, and a stream costs continuously. So the two numbers worth knowing are the row budget (how much disk a stream may take) and the events-per-second ceiling (how much work it may make a worker do). Past the ceiling events are sampled rather than queued — an unbounded queue in front of a slow writer is the crash, not the protection against it.

A stream holds a worker while it is consuming, so give streams a queue of their own (SQLDESK_STREAM_QUEUE is not a setting yet — the jobs go on streams, and a worker whose QUEUES names it is what keeps a consumer out of the way of the queries people are waiting for). One worker per active stream, and only while somebody is watching: see a stream is a window.

Raw events live in a DuckDB file per stream, under the same volume as uploaded files — so the uploads volume is what fills if a budget is set too high. The per-minute rollups live in Postgres, because they are small by construction and are the part that has to survive a restart.