Skip to main content

DbSchemaInfo

Defined in: js-api/src/data.ts:485

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​

Constructor​

new DbSchemaInfo(dart): DbSchemaInfo

Defined in: js-api/src/data.ts:492

Creates a new DbSchemaInfo wrapper.

Parameters​

ParameterTypeDescription
dartanyThe underlying Dart object representing a database schema.

Returns​

DbSchemaInfo

Properties​

PropertyModifierTypeDefined in
dartpublicanyjs-api/src/data.ts:486

Accessors​

catalog​

Get Signature​

get catalog(): string

Defined in: js-api/src/data.ts:506

Returns​

string


comment​

Get Signature​

get comment(): string | undefined

Defined in: js-api/src/data.ts:512

Returns​

string | undefined

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


connection​

Get Signature​

get connection(): DataConnection

Defined in: js-api/src/data.ts:526

The parent DataConnection this schema belongs to.

Returns​

DataConnection

A DataConnection instance.


llmComment​

Get Signature​

get llmComment(): string | undefined

Defined in: js-api/src/data.ts:518

Returns​

string | undefined

User-defined comment used by AI query builder.


name​

Get Signature​

get name(): string

Defined in: js-api/src/data.ts:502

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

Returns​

string

The name of this schema.

Methods​

annotateColumn()​

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

Defined in: js-api/src/data.ts:594

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",
});

annotateTable()​

annotateTable(table, props): Promise<void>

Defined in: js-api/src/data.ts:566

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,
});

getTables()​

getTables(): Promise<TableInfo[]>

Defined in: js-api/src/data.ts:534

Lists all tables belonging to this schema.

Returns​

Promise<TableInfo[]>

A promise resolving to an array of TableInfo objects.


setComment()​

setComment(comment): Promise<void>

Defined in: js-api/src/data.ts:540

Parameters​

ParameterType
commentstring

Returns​

Promise<void>


setLlmComment()​

setLlmComment(llmComment): Promise<void>

Defined in: js-api/src/data.ts:544

Parameters​

ParameterType
llmCommentstring

Returns​

Promise<void>