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
| Parameter | Type | Description |
|---|---|---|
dart | any | The underlying Dart object representing a database schema. |
Returns
Source
Properties
| Property | Modifier | Type |
|---|---|---|
dart | public | any |
Accessors
comment
getcomment():string
Returns
string
A comment string, or an empty string if none exists.
Source
connection
getconnection():DataConnection
The parent DataConnection this schema belongs to.
Returns
A DataConnection instance.
Source
llmComment
getllmComment():string
Returns
string
User-defined comment used by AI query builder.
Source
name
getname():string
Schema name (e.g., "public", "dbo").
Returns
string
The name of this schema.
Source
tables
gettables():Promise<TableInfo[]>
Lists all tables belonging to this schema.
Returns
Promise <TableInfo[]>
A promise resolving to an array of TableInfo objects.
Source
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
| 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",
});
Source
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
| 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,
});
Source
setComment()
setComment(
comment):Promise<void>
Parameters
| Parameter | Type |
|---|---|
comment | string |
Returns
Promise<void>
Source
setLlmComment()
setLlmComment(
llmComment):Promise<void>
Parameters
| Parameter | Type |
|---|---|
llmComment | string |
Returns
Promise<void>