Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.8k stars 320 forks source link

Azurite doesn't support filter parameter when use query table operation on table. #675

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: Azurite doesn't support filter parameter and return all tables when use query table operation on table.

To Reproduce: The demo code is shown as following:

import * as assert from "assert"
import { TableServiceClient, odata } from "@azure/data-tables";

async function main() {
  const tableName = "mytable";
  const tableServiceClient = TableServiceClient.fromConnectionString("<Azurite-https-connection-string>");
  await tableServiceClient.createTable(tableName);
  var queryTableResults = tableServiceClient.listTables({
    queryOptions: { filter: odata`TableName eq ${tableName}` }
  });
  for await (const table of queryTableResults) {
    assert.ok(table.tableName);
  }

  await tableServiceClient.deleteTable(tableName);
  queryTableResults = tableServiceClient.listTables({
    queryOptions: { filter: odata`TableName eq ${tableName}` }
  });
  for await (const table of queryTableResults) {
    assert.ok(!table.tableName);
  }
}

main().catch((err) => {
  console.error(err);
});

Error Track: In Azurite, the statement of the method queryTable lacks filter parameter. the code is shown as following: https://github.com/Azure/Azurite/blob/table/src/table/persistence/LokiTableMetadataStore.ts#L153 Screenshot 2021-01-14 182505

Expected Behavior: Azurite support filter parameter when use query table operation on table.

@jongio for notification.

XiaoningLiu commented 3 years ago

Thanks for reporting. That's a missing feature for Table.

XiaoningLiu commented 3 years ago

QueryEntities already supports filter parameter, refer to https://github.com/Azure/Azurite/blob/7ffe161cdb8be3976f1a64c1eb0c12e59304b77d/src/table/handlers/TableHandler.ts#L466

v-xuto commented 3 years ago

azsdk-azurite

jroselle commented 3 years ago

Additional info - Filter parameters still not working correctly. Consider the following image - filtering by PartitionKey works, filtering by string data works, filtering by INT does not work. To reproduce, simply create a table record with an Int32 and attempt to retrieve just that record. Attached image, filter URL looks correct in all cases. Works in classic azure storage emulator. I'm unable to migrate to Azurite for local dev. On version 3.14

image

zzhxiaofeng commented 3 years ago

@jroselle I didn't reproduce the question. I create a table record with an Int32 and retrieve the record by Int successfully. Can you tell me the detailed steps to reproduce the question?

jroselle commented 3 years ago

Interesting. I will build a demo app with smallest repro I can and upload it.

jroselle commented 3 years ago

Program.txt Repro.zip

I've attached a very simple repro. Works in classic storage emulator, does not work in azurite. I've tried the docker container, the vs plugin and npm azurite. all return same error, perhaps you have a newer secret version? I'm using 3.14.0.

Here's the log from Azurite docker image:

image

zzhxiaofeng commented 3 years ago

@jroselle Ok, I have reproduced your question. The reason is you use Azurite 3.14.0. You can get the latest version Azurite v3.14.1 and have a try.

jroselle commented 3 years ago

Thank you, I've confirmed that cloning the repository and building works (npm ci failed but I was able to work around that.) Is there a timeline on when the official release will come through so I can get the full vscode/docker integration?

zzhxiaofeng commented 3 years ago

@XiaoningLiu Something is wrong when use npm ci. What's more, do you know when the official release will come through?