Skip to main content

Db

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

Constructors​

Constructor​

new Db(): Db

Returns​

Db

Methods​

buildMutation()​

buildMutation(connectionId, tableName): TableMutationBuilder

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

Creates a TableMutationBuilder for fluent UPDATE/DELETE composition.

Parameters​

ParameterTypeDescription
connectionIdstringfully-qualified connection name (see [nqName])
tableNamestringdatabase table name

Returns​

TableMutationBuilder


buildQuery()​

buildQuery(connectionId, tableName): TableQueryBuilder

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

Creates TableQueryBuilder that can be used to construct sql queries.

Parameters​

ParameterTypeDescription
connectionIdstringfully-qualified connection name (see [nqName])
tableNamestringdatabase table name

Returns​

TableQueryBuilder


ddl()​

ddl(connectionId): DdlBuilder

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

Creates a DdlBuilder for structured DDL (create/alter/drop tables, indexes, keys) against the [connectionId] connection. Every operation supports dryRun() (the exact SQL plus live-data destructive pre-checks) and the confirmDestructive execution contract — see DdlCommand.

Parameters​

ParameterTypeDescription
connectionIdstringfully-qualified connection name (see [nqName])

Returns​

DdlBuilder


getInfo()​

getInfo(connection, catalog?): Promise<DbInfo[]>

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

Returns database catalog (e.g. database) information for the given connection. If catalog is specified, returns only the matching catalog. For databases that don't support catalogs (e.g., MySQL, Oracle), returns a single DbInfo with the name from the connection's db property, or '<unknown database name>' if not set.

Parameters​

ParameterTypeDefault value
connectionDataConnectionundefined
catalogstring | nullnull

Returns​

Promise<DbInfo[]>


query()​

query(connectionId, sql): Promise<DataFrame>

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

Executes a specified sql against the specified connectionId.

Parameters​

ParameterTypeDescription
connectionIdstringfully-qualified connection name (see [nqName])
sqlstringSQL statement

Returns​

Promise<DataFrame>


table()​

table(connectionId, tableName): DbTable

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

Returns a DbTable for structured writes (insert/upsert/update/delete) against [tableName] on the [connectionId] connection.

Parameters​

ParameterTypeDescription
connectionIdstringfully-qualified connection name (see [nqName])
tableNamestringdatabase table name (optionally schema-qualified, e.g. public.orders)

Returns​

DbTable