Skip to content

Allow us call ToSqlQueryText on an IQueryable<T> #578

Closed

Description

Is your feature request related to a problem? Please describe.
Right now all LINQ queries must go through a unique GetItemLinqQueryable method. This method is different than GetItemQueryIterator and GetItemQueryStreamIterator. The default response factory for LINQ queries is to deserialize into the desired type. If I want to write a LINQ query that returns a stream iterator I cant.

For debugging purposes it's also useful to see the generated SQL statement and log it if it exceeds a certain RU cost. The v2 SDK overwrote the ToString method on the DocumentQuery to facilitate this. A string is loggable, a LINQ query is not.

Describe the solution you'd like
I'd like the SDK to allow me to convert an IQueryable to a SQL string which I can then use to pass to either GetItemQueryIterator or GetItemQueryStreamIterator. From the string I can also log the request if the response exceeds a given amount of RUs (or any other metrics).

Describe alternatives you've considered
Abandoning LINQ and just using strings or forking the repository to make a custom version.

Additional context
A LINQ query is a compile-time type safe way to write queries and IMHO is a far superior approach than writing strings which are harder to refactor and verify are correct. This seems like a local transformation task separate from the query which needs to work with response data.

It also seems like it would simplify the SDK as callers choose to use LINQ or strings and all the query APIs need is to accept a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or requestimprovementChange to existing functional behavior (perf, logging, etc.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions