Skip to content

Commit

Permalink
Fix parsing of mgmt commands (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsafMah authored May 1, 2023
1 parent 0ddba44 commit 43accdc
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 21 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Not released

## [5.0.3] - 2023-04-30
## Added

- ConnectionBuilder accept path to certificate
- new static method ConnectionBuilder.withTokenCredential
- ConnectionStringBuilder now accepts certificate path
- ConnectionStringBuilder now accepts a TokenCredential
### Fixed
- Fixed parsing of certain commands

## [5.0.2] - 2023-04-18

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"useWorkspaces": true,
"version": "5.0.2"
"version": "5.0.3"
}
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/azure-kusto-data/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-kusto-data",
"version": "5.0.2",
"version": "5.0.3",
"description": "Azure Data Explorer Query SDK",
"module": "dist-esm/src/index.js",
"types": "./types/src/index.d.ts",
Expand Down
5 changes: 5 additions & 0 deletions packages/azure-kusto-data/src/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ export class KustoResponseDataSetV1 extends KustoResponseDataSet {
QueryResult: WellKnownDataSet.PrimaryResult,
QueryProperties: WellKnownDataSet.QueryProperties,
QueryStatus: WellKnownDataSet.QueryCompletionInformation,
PrimaryResult: WellKnownDataSet.PrimaryResult,
};
}

Expand Down Expand Up @@ -187,6 +188,10 @@ export class KustoResponseDataSetV1 extends KustoResponseDataSet {
this.tables[i].name = current.Name;
this.tables[i].id = current.Id;
this.tables[i].kind = KustoResponseDataSetV1.getTablesKinds()[current.Kind];

if (this.tables[i].kind === WellKnownDataSet.PrimaryResult) {
this.primaryResults.push(this.tables[i]);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/azure-kusto-data/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
// Licensed under the MIT License.

// SDK_VERSION should be updated in all 3 package.json and lerna.json(by running lerna version)
export const SDK_VERSION = "5.0.0";
export const SDK_VERSION = "5.0.3";
4 changes: 2 additions & 2 deletions packages/azure-kusto-ingest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-kusto-ingest",
"version": "5.0.2",
"version": "5.0.3",
"description": "Azure Data Explorer Ingestion SDK",
"module": "dist-esm/src/index.js",
"types": "./types/src/index.d.ts",
Expand Down Expand Up @@ -61,7 +61,7 @@
"@types/tmp": "^0.2.3",
"@types/uuid": "^8.3.4",
"@types/uuid-validate": "0.0.1",
"azure-kusto-data": "^5.0.2",
"azure-kusto-data": "^5.0.3",
"browserify-zlib": "0.2.0",
"stream-array": "^1.1.2",
"stream-browserify": "3.0.0",
Expand Down
18 changes: 16 additions & 2 deletions packages/azure-kusto-ingest/test/e2eTests/e2eTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ const main = (): void => {
await Promise.all(
Object.values(tableNames).map(async (tableName) => {
try {
// run in parallel

await queryClient.execute(databaseName, `.create table ${tableName} ${tableColumns}`);
await queryClient.execute(databaseName, `.alter table ${tableName} policy streamingingestion enable`);
await queryClient.execute(databaseName, ".clear database cache streamingingestion schema");
Expand Down Expand Up @@ -400,6 +398,22 @@ const main = (): void => {
});
});

describe("Mgmt Parsing", () => {
it.concurrent("Parse .show tables correctly", async () => {
const result = await queryClient.execute(databaseName, ".show tables | project TableName, DatabaseName");
expect(result.tables.length).toBeGreaterThan(0);
expect(result.primaryResults.length).toBe(1);
expect(result.primaryResults[0].columns.map((c) => c.name)).toEqual(["TableName", "DatabaseName"]);
});

it.concurrent("Parse .show database correctly", async () => {
const result = await queryClient.execute(databaseName, `.show database ${databaseName} policy retention | project ChildEntities, EntityType`);
expect(result.tables.length).toBeGreaterThan(0);
expect(result.primaryResults.length).toBe(1);
expect(result.primaryResults[0].columns.map((c) => c.name)).toEqual(["ChildEntities", "EntityType"]);
});
});

const cleanStatusQueues = async () => {
while (!(await statusQueues.failure.isEmpty())) {
await statusQueues.failure.pop();
Expand Down
6 changes: 3 additions & 3 deletions packages/quick_start/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-kusto-quick-start",
"version": "5.0.2",
"version": "5.0.3",
"description": "Quick start Node sample app",
"main": "src/SampleApp.js",
"scripts": {
Expand All @@ -9,8 +9,8 @@
},
"dependencies": {
"@types/uuid": "^8.3.4",
"azure-kusto-data": "^5.0.2",
"azure-kusto-ingest": "^5.0.2",
"azure-kusto-data": "^5.0.3",
"azure-kusto-ingest": "^5.0.3",
"diff": "^5.1.0",
"uuid": "^8.3.2"
},
Expand Down

0 comments on commit 43accdc

Please sign in to comment.