CockroachDB
Official · maintained by Marmotmarmotdata/cockroachdb Discover databases, tables, views and foreign key relationships from CockroachDB clusters
The CockroachDB plugin discovers databases, tables, views and materialized views from CockroachDB clusters. It captures columns (including computed column expressions and comments), row and column counts, table sizes, partitioning, foreign key relationships and, for each view, a lineage edge from every table it reads to the view.
Tables and views are named database.schema.table, since one cluster holds many databases. Every database except system is discovered by default; set database to discover one, or exclude_databases to skip more. Hidden columns CockroachDB adds on its own (the rowid of a table without a primary key, the shard column of a hash-sharded index) are left out.
Connection
The plugin speaks the PostgreSQL wire protocol over the SQL port (26257 by default). Set ssl_mode to verify-full with ssl_root_cert for secure clusters, and ssl_cert plus ssl_key for certificate authentication. Leave password empty on insecure clusters.
Required Permissions
The user needs to connect to each database and read its tables:
CREATE USER marmot_reader WITH PASSWORD 'your-password';
GRANT CONNECT ON DATABASE your_db TO marmot_reader;
GRANT USAGE ON SCHEMA your_db.public TO marmot_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA your_db.public TO marmot_reader;
Table sizes come from span statistics, which need one extra system privilege. Without it the plugin logs a warning and skips asset.size_bytes:
GRANT SYSTEM VIEWACTIVITYREDACTED TO marmot_reader;
In the UI
Point-and-click, no config file needed.
- 1 Open Runs Create pipeline
- 2 Pick CockroachDB from the plugin list.
- 3 Fill in the wizard, set a schedule, save.
With the CLI
Save a YAML config, then run marmot ingest.
name: my-cockroachdb-pipeline
runs:
- cockroachdb:
host: "<host>"
user: "<user>"$ marmot ingest -c ingest.yamlNot using plugins? Other ways to populate Marmot
Configuration
17 top-level fields. * marks required fields.
tags multiselect Tags to apply to discovered assets
external_links object[] External links to show on all assets
name string Display name for the link
icon string Icon identifier for the link
url string URL to the external resource
filter object Filter discovered assets by name (regex)
include multiselect Include patterns for resource names (regex)
exclude multiselect Exclude patterns for resource names (regex)
host string CockroachDB node hostname or IP address
port int SQL port
- default
- 26257
user string SQL user
password password Password for the SQL user. Leave empty on insecure clusters or with certificate authentication
database string Discover only this database. Leave empty to discover every database
exclude_databases multiselect Databases to skip when discovering every database
- default
- ["system"]
ssl_mode select SSL mode (disable, require, verify-ca, verify-full)
- default
- disable
ssl_root_cert string Path to the CA certificate that signed the node certificates
ssl_cert string Path to the client certificate, for certificate authentication
ssl_key string Path to the client certificate key
include_columns bool Whether to include column information in table metadata
- default
- true
include_views bool Whether to discover views and materialized views
- default
- true
discover_foreign_keys bool Whether to discover foreign key relationships
- default
- true
include_statistics bool Whether to include row counts, column counts and table sizes
- default
- true
Assets emitted
Metadata this plugin attaches to each discovered asset.
Database
CockroachDBDatabaseFieldsThe metadata fields the plugin emits for database assets.
host stringCockroachDB node hostname
port intSQL port
database stringDatabase name
owner stringDatabase owner
server_version stringCockroachDB version string
Table
CockroachDBTableFieldsThe metadata fields the plugin emits for table and view assets.
database stringDatabase name
schema stringSchema name
table_name stringTable or view name
object_type stringObject type (table, view, materialized_view, foreign_table)
owner stringObject owner
comment stringObject comment
materialized boolWhether a view is materialized
partitioned boolWhether the table's primary index is partitioned
partition_columns stringColumns the table is partitioned on, comma separated
estimated_row_count intRow count estimated from the optimizer's table statistics
Column
CockroachDBColumnFieldsThe per-column fields embedded in an asset's schema.
column_name stringColumn name
data_type stringCockroachDB data type
is_nullable boolWhether null values are allowed
is_primary_key boolWhether the column is part of the primary key
description stringColumn comment
default_expression stringDefault value expression
generation_expression stringExpression of a computed column