DbSchemaInfo
Defined in: src/data.ts:324
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: src/data.ts:332
Creates a new DbSchemaInfo wrapper.
Parameters
| Parameter | Type | Description |
|---|---|---|
dart | any | The underlying Dart object representing a database schema. |
Returns
DbSchemaInfo
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
dart | public | any | src/data.ts:325 |
Accessors
catalog
Get Signature
get catalog():
string
Defined in: src/data.ts:347
Returns
string
comment
Get Signature
get comment():
string|undefined
Defined in: src/data.ts:354
Returns
string | undefined
A comment string, or an empty string if none exists.
connection
Get Signature
get connection():
DataConnection
Defined in: src/data.ts:370
The parent DataConnection this schema belongs to.
Returns
A DataConnection instance.
llmComment
Get Signature
get llmComment():
string|undefined
Defined in: src/data.ts:361
Returns
string | undefined
User-defined comment used by AI query builder.
name
Get Signature
get name():
string
Defined in: src/data.ts:343
Schema name (e.g., "public", "dbo").
Returns
string
The name of this schema.
Methods
annotateColumn()
annotateColumn(
table,column,props):Promise<void>
Defined in: src/data.ts:441
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
| Parameter | Type | Description |
|---|---|---|
table | string | TableInfo | A TableInfo instance or table name. |
column | string | ColumnInfo | A ColumnInfo instance or column name. |
props | DbColumnProperties | Column-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: src/data.ts:412
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
| Parameter | Type | Description |
|---|---|---|
table | string | TableInfo | Either a TableInfo instance or a table name. |
props | DbTableProperties | Table-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: src/data.ts:379
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: src/data.ts:385
Parameters
| Parameter | Type |
|---|---|
comment | string |
Returns
Promise<void>
setLlmComment()
setLlmComment(
llmComment):Promise<void>
Defined in: src/data.ts:389
Parameters
| Parameter | Type |
|---|---|
llmComment | string |
Returns
Promise<void>