Skip to content

SQL queries with property indexer(s) in SELECT clausule failes to execute #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tichaczech opened this issue Feb 27, 2025 · 3 comments
Assignees
Labels
cosmosEmulatorVnextPreview issues raised for the vNext Linux based emulator (preview) feature
Milestone

Comments

@tichaczech
Copy link

tichaczech commented Feb 27, 2025

Describe the bug
It is not possible to execute SQL with property indexer in SELECT clausule like this one: SELECT c["id"] FROM root c.
This is especially problem with EntityFramework Provider for Azure Cosmos DB, which generates SQL queries with property indexers.

To Reproduce
Steps to reproduce the behavior:

  1. Create instance of Azure Cosmos DB Emulator vNext using docker (https://learn.microsoft.com/en-us/azure/cosmos-db/emulator-linux#installation)
  2. Open Data Explorer (http://localhost:1234)
  3. Create new Database (choose name)
  4. Create new Container (choose name)
  5. Open new SQL Query window
  6. Paste following query: SELECT c["id"] FROM root c and execute
  7. See error

Expected behavior

  • Query should be executed, like the same query SELECT c.id FROM root c, which does not use property indexers
  • Query should be executed, like on real Cosmos DB instance

Screenshots
Emulator - Query with indexers
Image

Emulator - Query without indexers
Image

Real Cosmos DB - Query with indexers
Image

Real Cosmos DB - Query without indexers
Image

Desktop (please complete the following information):

  • OS: macOS Sequioa 15.3.1
  • Container image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview (81163737db55)
  • Container host: Podman v5.4.0

Additional context
It is possible to use property indexers in WHERE clausule - query like SELECT c.id FROM root c WHERE c["isActive"] = true will execute.

@tichaczech tichaczech added cosmosEmulatorVnextPreview issues raised for the vNext Linux based emulator (preview) needs-triage labels Feb 27, 2025
@tichaczech tichaczech changed the title SQL queries with property indexer(s) in SELECT clause failes to execute SQL queries with property indexer(s) in SELECT clausule failes to execute Feb 27, 2025
@lionelc
Copy link

lionelc commented Mar 5, 2025

@tichaczech we don't support [] as indexers. Please use c.id .

@xgerman xgerman assigned DmitriMelnikov and unassigned xgerman Mar 5, 2025
@xgerman xgerman added this to the Backlog milestone Mar 5, 2025
@tichaczech
Copy link
Author

@lionelc Honestly, and with all due respect - it makes no sense. I would understand if you would tell me "not supported for now" or "on our roadmap" but saying "rewrite your query" really makes no sense ¯\_(ツ)_/¯. At first, we are using ADO.NET EF for Cosmos DB (a .NET ORM framework initially created by Microsoft), which generates queries by itself — I have no control over it. But even if we write the query ourselves, it should work - simply because it works on Cosmos DB.

@lionelc
Copy link

lionelc commented Mar 5, 2025

@lionelc Honestly, and with all due respect - it makes no sense. I would understand if you would tell me "not supported for now" or "on our roadmap" but saying "rewrite your query" really makes no sense ¯\_(ツ)_/¯. At first, we are using ADO.NET EF for Cosmos DB (a .NET ORM framework initially created by Microsoft), which generates queries by itself — I have no control over it. But even if we write the query ourselves, it should work - simply because it works on Cosmos DB.

@tichaczech I was not aware you were using generated queries. We will put this item on our backlog. Thank you for your feedback. cc: @DmitriMelnikov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cosmosEmulatorVnextPreview issues raised for the vNext Linux based emulator (preview) feature
Projects
None yet
Development

No branches or pull requests

4 participants