Allow us call ToSqlQueryText on an IQueryable<T> #578
Labels
feature-request
New feature or request
improvement
Change to existing functional behavior (perf, logging, etc.)
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.
The text was updated successfully, but these errors were encountered: