Skip to main content

What is a source ?​

Data sources are data stored in your organization, it's an endpoint and the central elements of QALITA Platform. They are referenced in the platform, and the original data is never stored in the platform.

Reference a Source​

Referencing a source is a way to tell Platform that you have data accessible at this endpoint, it can be a file path, or database credentials.

You can reference a source two ways :

  1. You can do it using the QALITA CLI source add command.
  2. Your can do it using the QALITA CLI UI

When you reference a source, QALITA CLI creates a configuration file sources-conf.yaml in the ~/.qalita/ directory, which contains the connection information for the source.

sources-conf.yaml
version: 1
sources:
- config:
path: /data/heart/
description: 11 clinical features for predicting heart disease events.
id: 1
name: Heart Failure Prediction Dataset
reference: true
sensitive: true
type: file
validate: valid
visibility: internal
File and folder paths

The path of a file or folder source is read by the worker. When the worker runs in Docker, it is a path inside its container, so the data must be mounted into the container first. See File and folder sources, including network shares.

In this example, the source is a local file, but it could also be a database, a remote file, a data stream, etc.

PropertyDescription
versionConfiguration version
sourcesList of sources
configSource configuration, properties vary depending on the source type.
idUnique source identifier, this ID is obtained from the platform after finalizing the source referencing with the qalita source push command.
nameSource name
typeSource type
referenceIf the source is a reference, it allows comparison with other sources.
sensitiveIf the source is sensitive, special permission is required to access it see permissions
validateIf the source is valid, it means the client has proper access to the source, and it can be referenced on the platform.
visibilitySource visibility, can be public, internal, or private. Allows restricting access to different user profiles on the platform.
access_modeHow the platform reaches the source: service (shared service-account credentials) or user (the credentials of one named person). See Access modality.
Keep credentials out of sources-conf.yaml

A source's config can reference a secret instead of holding it, here a Docker or Kubernetes secret mounted on the Worker:

config:
password: ${secret:pg_password}

Environment variables and files written by Vault Agent or Azure Key Vault work too. References are accepted only in configurations written on the Worker. See Source secrets.

Access modality​

A source's credentials live on the Worker, never on the platform. Who those credentials belong to changes what the platform is allowed to do with the source, so every source declares an access modality.

ModalityMeaning
serviceThe Worker holds the credentials of a shared service account. Anyone entitled to see the source may read it. This is the default, and the behaviour QALITA has always had.
userThe Worker holds the credentials of one named person — typically their own Active Directory account, carrying their own rights on the database.

Why it matters​

If your database grants rights per user — each person connecting with their own account and seeing a different subset of the data — then a source registered with one person's credentials carries that person's rights. Letting a colleague read it through the platform would hand them access the database never granted them, and the permission chain your DBA set up would be broken at the application layer.

So a source declared user is subject to three rules the platform enforces for you:

  • its visibility is necessarily private, and cannot be changed;
  • it is readable only by the person it is bound to — sharing it through the usual source associations does not grant access;
  • it is served only by the Worker that holds those credentials. If that Worker is offline, the platform says so rather than falling back to another one.

Choosing the modality​

You choose it when referencing the source. The platform then binds the source to the Worker used and to you.

Tightening a source from service to user is allowed at any time — it only ever removes access. The reverse is refused: to move a source back to a service account you must reference it again through a Worker configured with service-account credentials, because that is the only way to prove the credentials actually changed.

warning

A user or a Worker that owns a user-mode source cannot be deleted while that source exists. Reassign or delete the person's nominative sources first. This is deliberate: silently unbinding such a source would leave data reachable with credentials nobody is accountable for.

When a source is not visible​

A source may be absent from a listing for three reasons: it is private and not shared with you, it is nominative and belongs to someone else, or it is marked sensitive and you lack the corresponding habilitation. Where the platform can say which, it does — Studio shows the reason and what to do about it.

The same rules cover everything the platform derives from a source: its run history, routines, schema, metrics, scores and figures, recommendations and tickets, the AI tips, chat and description suggestions of the source page, what Studio's agent reads for you, and the tickets it updates, comments or closes for you. Administrators follow them too: a role opens features, not sources.

  • Through the API, the routes that serve a source's data (/api/v1/sources/{id}/..., and /api/v1/routines, /metrics, /recommendations and /figures for a given source) answer 403 for a source of your team that you cannot read, with the reason as code: PRIVATE_NOT_SHARED, USER_BOUND_SOURCE or SENSITIVE_HABILITATION_REQUIRED. An id that is not a source of your team, a public source of another team included, answers 404 with SOURCE_NOT_FOUND.
  • The /api/v2 resources (runs, routines, metrics, recommendations, schemas, tickets) treat a record of a source you cannot read as missing: reading it by id answers 204, as for an unknown id, and so does updating or deleting it where the resource allows it.
  • Listings (runs, routines, metrics, recommendations, schemas, tickets, the jobs of a Worker) leave out what you cannot read, and so do runs and routines compared with a target source you cannot read.
  • A ticket attached to no source stays visible to the whole team.

Source Types​

Sources can be of any type, as long as there are packs to process them. QALITA Platform imposes no limitations on source types.

PostgreSQL connection role and search_path​

Some PostgreSQL databases grant read rights to a group role rather than to the login itself: you connect with your login, then switch to that role with SET ROLE before reading. A PostgreSQL source can declare that role, and a search_path, so that QALITA applies them on every connection it opens to the database.

PropertyDescription
roleRole taken on every connection, as SET ROLE would. Give the exact role name, without quotes: it is case-sensitive. The role must be granted to the login (GRANT app_reader TO login_user).
search_pathComma-separated list of schemas searched for unqualified table names, for example analytics, public. PostgreSQL lower-cases unquoted names: write a mixed-case schema in double quotes ("Sales", public).

Both are optional. Left empty, the connection keeps the login's own rights and the server's default search_path, as before.

schema and search_path do different things. schema tells QALITA which schema to scan and how to qualify the tables it reads. search_path tells the database where to look for table names written without a schema, for example in a SQL query set as table_or_query, or in the queries Studio's agent writes.

How they are applied​

QALITA sends them as libpq startup options (options=-c role=... -c search_path=...). The server applies them as session defaults when the connection opens, before any query runs. A role that is not granted to the login makes the connection itself fail, with PostgreSQL's error (permission denied to set role "...").

They are applied everywhere QALITA connects to the source:

  • the connection check when the source is referenced from the platform, with qalita source add / qalita source validate, or from the CLI UI. This check also verifies that the session really runs as the role (SELECT current_user) and reports it otherwise. From the platform, the worker runs this check for PostgreSQL, MySQL and MariaDB sources only;
  • pack runs;
  • Studio previews and agent queries.

From the platform​

In Sources, add a source, choose a worker, then PostgreSQL: the form shows the Role and Search path fields after Schema.

When the worker's connection check fails, for instance because the role is not granted to the login, the source is still registered, and the confirmation message says that the connection check failed, followed by the worker's error. The credentials live on the worker: to correct the role, edit the source on that worker (CLI UI or sources-conf.yaml), or delete the source and reference it again.

The form reports a failed check for PostgreSQL, MySQL and MariaDB sources only. For these types, a plain confirmation means that the worker connected, provided the platform is 3.2.0 or later and the worker runs QALITA CLI 3.2.0 or later: an older platform does not report a failed check, and an older worker does not run the check. For any other type, a plain confirmation only means that the source is registered. The worker tries a preview instead, and reports a failed Oracle, SQL Server or SQLite connection, but the platform does not show it. connectivity_verified in the API answer says whether the worker verified the connection (see Through the API).

With the CLI​

qalita source add --role app_reader --search-path analytics,public

Without these options, qalita source add asks for both after the schema, for PostgreSQL sources; press Enter to leave them empty. In the CLI UI, the PostgreSQL form has the matching Role (optional) and Search path (optional) fields; clearing a field removes the setting.

Either way, the source is stored in sources-conf.yaml:

sources-conf.yaml
version: 1
sources:
- name: warehouse
type: postgresql
description: Analytics warehouse
reference: false
sensitive: false
visibility: private
config:
type: postgresql
host: db.example.com
port: 5432
username: login_user
password: "********"
database: warehouse
schema: analytics
role: app_reader
search_path: analytics, public
table_or_query: "*"

Through the API​

POST /api/v1/sources/register takes the same keys in config (authenticated request, source:create permission):

{
"worker_id": 3,
"name": "warehouse",
"type": "postgresql",
"description": "Analytics warehouse",
"visibility": "private",
"access_mode": "service",
"reference": false,
"sensitive": false,
"config": {
"host": "db.example.com",
"port": 5432,
"username": "login_user",
"password": "********",
"database": "warehouse",
"schema": "analytics",
"role": "app_reader",
"search_path": "analytics, public",
"table_or_query": "*"
}
}

Blank values are dropped and values containing control characters are refused (HTTP 422). When the worker saved the source but its connection check failed, the answer has "ok": true, "connectivity_verified": false, and the reason in "error". Platform 3.2.0 or later passes this reason on, for PostgreSQL, MySQL and MariaDB sources only; an older platform never does. "connectivity_verified" is the worker's own answer: true means that the worker reached the source, through the connection check or, for the other types, a preview. On platform 3.2.0 or later, false without "error" means that the connection was not verified: the worker runs a QALITA CLI older than 3.2.0, or the source is of another type and its preview failed. For Oracle, SQL Server and SQLite, that includes a failed connection: the worker reports it, but the platform does not pass it on.

Precedence over connection_string​

When the source configuration holds an explicit connection_string, it is used as is: role and search_path are ignored, and a warning is logged. In that case, add the URL-encoded options parameter to the connection string yourself:

postgresql://login_user:password@db.example.com:5432/warehouse?options=-c%20role%3Dapp_reader%20-c%20search_path%3Danalytics%2Cpublic

Limits​

  • PostgreSQL sources only. The keys are ignored for other database types (Snowflake has its own role field).
  • Connection poolers: PgBouncer rejects the options startup parameter, so the connection fails, or drops it when it is listed in ignore_startup_parameters, so the session runs with the login's own rights. The connection check reports the second case (Connected as 'login_user' instead of role 'app_reader'). Connect these sources directly to PostgreSQL, or through a pooler that forwards startup options.
  • QALITA escapes spaces and backslashes in the values itself; do not add quotes or -c yourself.
  • Versions: which component applies the keys depends on the path.
    • Registering the source from the platform needs platform 3.2.0 or later: it shows the Role and Search path fields and passes the keys to the worker. An older platform drops them.
    • From QALITA CLI 3.2.0, the worker's QALITA CLI applies them to the connection check at registration, qalita source add / qalita source validate, the CLI UI, Studio previews and agent queries. A worker on an older QALITA CLI ignores them there, and does not run the connection check when the source is referenced from the platform.
    • Pack runs open their connection through the qalita-core locked in the pack, whatever the worker's version. A pack locked on qalita-core 2.2.0 or later applies them even on an older worker; a pack locked on an earlier qalita-core does not apply them, even on an up-to-date worker.