diff --git a/src/table.ts b/src/table.ts index d4b3400d..eeeb4a77 100644 --- a/src/table.ts +++ b/src/table.ts @@ -37,6 +37,7 @@ import IType = Ydb.IType; import DescribeTableResult = Ydb.Table.DescribeTableResult; import PrepareQueryResult = Ydb.Table.PrepareQueryResult; import ExecuteQueryResult = Ydb.Table.ExecuteQueryResult; +import ExplainQueryResult = Ydb.Table.ExplainQueryResult import ITransactionSettings = Ydb.Table.ITransactionSettings; import BeginTransactionResult = Ydb.Table.BeginTransactionResult; import ITransactionMeta = Ydb.Table.ITransactionMeta; @@ -671,6 +672,17 @@ export class Session extends EventEmitter implements ICreateSessionResult { }); }); } + + public async explainQuery(query: string, operationParams?: Ydb.Operations.IOperationParams): Promise { + const request: Ydb.Table.IExplainDataQueryRequest = { + sessionId: this.sessionId, + yqlText: query, + operationParams + }; + const response = await this.api.explainDataQuery(request); + const payload = getOperationPayload(this.processResponseMetadata(request, response)); + return ExplainQueryResult.decode(payload); + } } type SessionCallback = (session: Session) => Promise;