Skip to main content

DbSchemaInfo

Represents metadata for a specific database schema in Datagrok.

DbSchemaInfo provides access to schema-level information such as tables, user and LLM comments, and utilities for annotating tables and columns.

Mutation methods do not modify underlying database, they just create metadata in Datagrok.

Constructors

new DbSchemaInfo()

new DbSchemaInfo(dart): DbSchemaInfo

Creates a new DbSchemaInfo wrapper.

Parameters

ParameterTypeDescription
dartanyThe underlying Dart object representing a database schema.

Returns

DbSchemaInfo

Source

src/utils.ts:760

Properties

PropertyModifierType
dartpublicany

Accessors

comment

get comment(): string

Returns

string

A comment string, or an empty string if none exists.

Source

src/utils.ts:778


connection

get connection(): DataConnection

The parent DataConnection this schema belongs to.

Returns

DataConnection

A DataConnection instance.

Source

src/utils.ts:794


llmComment

get llmComment(): string

Returns

string

User-defined comment used by AI query builder.

Source

src/utils.ts:785


name

get name(): string

Schema name (e.g., "public", "dbo").

Returns

string

The name of this schema.

Source

src/utils.ts:771


tables

get tables(): Promise <TableInfo[]>

Lists all tables belonging to this schema.

Returns

Promise <TableInfo[]>

A promise resolving to an array of TableInfo objects.

Source

src/utils.ts:803

Methods

annotateColumn()

annotateColumn(table, column, props): Promise<void>

Adds or updates metadata for a column within a table. It's just only meta annotation which is stored in Datagrok and real database is not affected.

Parameters

ParameterTypeDescription
tablestring | TableInfoA TableInfo instance or table name.
columnstring | ColumnInfoA ColumnInfo instance or column name.
propsDbColumnPropertiesColumn-level annotations such as uniqueness, min/max values, and comments.

Returns

Promise<void>

A promise that resolves when the annotation is saved.

Example

await schema.annotateColumn("orders", "order_id", {
isUnique: true,
comment: "Primary key for the orders table",
});

Source

src/utils.ts:865


annotateTable()

annotateTable(table, props): Promise<void>

Adds or updates metadata for a specific table in this schema. It's just only meta annotation which is stored in Datagrok and real database is not affected.

Parameters

ParameterTypeDescription
tablestring | TableInfoEither a TableInfo instance or a table name.
propsDbTablePropertiesTable-level properties such as comments, row counts, and domains.

Returns

Promise<void>

A promise that resolves when the annotation is saved.

Example

await schema.annotateTable("customers", {
comment: "Master table containing customer profiles",
rowCount: 120345,
});

Source

src/utils.ts:836


setComment()

setComment(comment): Promise<void>

Parameters

ParameterType
commentstring

Returns

Promise<void>

Source

src/utils.ts:809


setLlmComment()

setLlmComment(llmComment): Promise<void>

Parameters

ParameterType
llmCommentstring

Returns

Promise<void>

Source

src/utils.ts:813