marmotdata/sqlite
Discover tables, views and foreign key relationships from SQLite database files
The SQLite plugin discovers tables, views and foreign key relationships from SQLite database files.
Tables are identified in their MRN by the database file name without its extension and the table name, for example mrn://asset/table/sqlite/app.orders. The identity is tied to the file, so set zone when several machines hold their own copy of the same file name and you want them kept apart or shared deliberately. The name is one you choose, not a cloud availability zone.
It uses the pure-Go modernc.org/sqlite driver, so it needs no cgo and opens the database read-only. Turso and libSQL files are stored in the SQLite on-disk format, so a local copy of one works the same as any other SQLite file.
File Sources
The path field accepts local paths, S3 URIs (s3://bucket/key) or Git URIs (git::https://...). For S3 and Git sources, the file is downloaded to a temporary directory before discovery and cleaned up afterwards.
See File Sources for the full list of supported backends, authentication options and configuration examples.
Querying
This plugin lets Marmot run read-only SQL against a SQLite file for data queries. Every statement is checked before it reaches SQLite: anything other than a single SELECT, WITH, VALUES or TABLE statement is refused, along with ATTACH, DETACH, PRAGMA, VACUUM, a call to load_extension and a second statement hidden after a semicolon. The connection itself is opened with mode=ro and PRAGMA query_only=ON, which is the real boundary: SQLite refuses to write to the file at all, even if a check above were somehow bypassed.
Planning uses EXPLAIN to read a statement's compiled bytecode rather than running it, and refuses anything whose bytecode would write, which catches a write hidden behind a leading WITH. The tables a statement's bytecode opens for reading are mapped back to the same MRN discovery gives them, using sqlite_master, so grants written against catalogued assets bind on the query path too. SQLite always reads a view by reading its base tables rather than the view itself, so a query over a view is reported and granted against those base tables.
A statement that calls a table-valued function such as pragma_table_info or json_each can read a table the bytecode never names, so its plan is marked incomplete and needs a grant on the whole source.
In the UI
Point and click, no config file needed.
- Open Runs and choose Create pipeline.
- Pick SQLite from the plugin list.
- Fill in the settings, set a schedule and save.
With the CLI
Save a YAML config, then run marmot ingest.
Not using plugins? Other ways to populate Marmot
Configuration
Fields marked Required must be set.
tagsList of textTags to apply to discovered assets
external_linksList of groupsExternal links to show on all assets
nameTextDisplay name for the link
iconTextIcon identifier for the link
urlTextURL to the external resource
filterGroup of settingsFilter discovered assets by name (regex)
includeList of textInclude patterns for resource names (regex)
excludeList of textExclude patterns for resource names (regex)
zoneTextTells this system apart from others of the same technology and becomes part of every asset's MRN
s3_sourceGroup of settingsS3 file source configuration
credentialsGroup of settingsAWS credentials for S3 access
use_defaultYes or noUse AWS credentials from environment or default profile (recommended)
idTextAWS access key ID
secretSecretAWS secret access key
tokenSecretAWS session token
profileTextAWS profile to use from shared credentials file
role_arnTextIAM role to assume with the Marmot identity token (AssumeRoleWithWebIdentity); its trust policy names the Marmot issuer as an OIDC provider. Setting it federates: no keys are needed, and region is required. role, if also set, is assumed on top of it
roleTextAWS IAM role ARN to assume with AssumeRole from the base credentials (static keys, a profile, the default chain, or role_arn)
role_external_idTextExternal ID for cross-account role assumption
regionTextAWS region for services
endpointTextCustom endpoint URL for AWS services
git_sourceGroup of settingsGit repository file source configuration
urlTextGit repository URL
refTextBranch, tag or commit to check out
pathTextSubdirectory within the repository
tokenSecretPersonal access token for HTTPS auth
ssh_key_pathTextPath to SSH private key for SSH auth
pathText RequiredPath to the SQLite database file (local path, s3://bucket/key or git::url)
include_columnsYes or noWhether to include column information in table metadata
enable_metricsYes or noWhether to include table metrics (row and column counts)
discover_foreign_keysYes or noWhether to discover foreign key relationships
exclude_system_tablesYes or noWhether to exclude SQLite internal tables (sqlite_*)
Assets emitted
Metadata this plugin attaches to each discovered asset.
SQLite
The metadata fields the SQLite plugin emits for table and view assets.
Column
The per-column fields embedded in an asset's schema.
Foreign Key
The fields of a discovered foreign key relationship.