Skip to main content
A plugin that starts or knows about a database (a local dev stack, a cloud tool, a container runner) can add a data source to the project’s Database tool window, so the user doesn’t have to type the connection settings. The plugin manages only the sources it created; it never sees user-created sources, other plugins’ sources or any stored password. Once a source exists, the user works with it through the normal Database tools. This is the database host interface (database.wit, API 1.4).

Manifest

database.sources is needed for every call, and every call needs a trusted, open project.

Create a source and connect

The data source record

PluginDataSource (WIT database.data-source) holds non-secret settings only: Never put credentials in a settings field. URLs containing a password or credential query parameters, and password, token or secret options, are rejected. Use set_data_source_credential instead. There is no function that reads a credential back, not even one the plugin just wrote.

Where it is stored

  • Owned sources are written to the project’s .openidea/data-sources.toml with pluginOwner and pluginSourceId. Updates keep unrelated entries, comments and formatting. The file must use the normal [[data-source]] table format; inline table arrays are rejected. No password is written there.
  • The Database tree refreshes when sources change and labels owned sources with the plugin id. Duplicating one creates a user-owned copy.
  • Disabling the plugin keeps its sources. Uninstalling removes them and their credentials, also in closed projects the host remembers.

Connecting

connect_data_source is valid only from a command or event of that project’s window. It uses the usual Database connection flow, password prompt and introspection. Waiting for the window doesn’t count against the plugin’s call budget; the window must answer within 180 seconds, and the call can be cancelled.

Limits and errors

  • At most 64 sources per plugin and project; each value or optional field at most 16 KiB; a credential at most 64 KiB.
  • An unknown id, or one owned by someone else, returns not-found without revealing whether another owner’s source exists.
  • In remote projects, sources and credentials are stored where the Database subsystem runs, on the project server. A host without that subsystem returns invalid("Database subsystem is unavailable on this host").
The data-tools fixture calls every function from commands.