-
-
Notifications
You must be signed in to change notification settings - Fork 462
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
Advanced SQL query #3042
Merged
Merged
Advanced SQL query #3042
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e-tobi
force-pushed
the
advanced-sql-query
branch
6 times, most recently
from
March 15, 2024 19:53
4e40b58
to
58ac8d7
Compare
I'm going to put this into 7.4 later this week if that's okay. I'm rushing out a bug fix release first |
e-tobi
force-pushed
the
advanced-sql-query
branch
2 times, most recently
from
March 24, 2024 19:31
9a035ec
to
1a5c797
Compare
e-tobi
force-pushed
the
advanced-sql-query
branch
from
March 25, 2024 22:03
18d17d7
to
c6cbfb9
Compare
Remove token parameter comment on overloades without a CancellationToken
http://jasperfx.github.io/marten/documentation/... -> https://martendb.io/... The URL's should probably removed - these are the only 3 URLs referencing the online documentation.
AdvancedSqlQuery<T>(sql, token, parameters) allows to provide a complete SQL query containing all required columns. The columns in the select clause must be in the correct order.
...in SystemTextJsonSerializer. The DbDataReader might be implemented by a NpgsqlNestedDataReader instead of a NpgsqlDataReader. Use GetFieldValueAsync<Stream>() instead, which is called by NpgsqlDataReader.GetStreamAsync(), See: https://github.com/npgsql/npgsql/blob/fbbb28245ed3475d0857888622939ba7f13cb04f/src/Npgsql/NpgsqlDataReader.cs#L1456
e-tobi
force-pushed
the
advanced-sql-query
branch
from
March 25, 2024 22:12
c6cbfb9
to
2bad7bd
Compare
This will go into 7.5 shortly. I didn't mean to keep this lingering so long. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AdvancedSqlQueryAsync<T, ...>(sql, ...) allows to perform more complex SQL queries than would be possible with Query(sql). It allows to query documents, scalars and deserializable JSON objects or any combination of these returned as a tuple.
This also allows to query for related documents. Metadata mapping, dirty tracking etc. for documents is fully supported. The full SQL must be provided (no "magic" SQL building) so the user is responsible to provide all the columns needed by Marten in the correct order.
Currently result tuples with up to 3 elements are possible (a single result type will not be returned as a tuple). This could be easily extend, but then I would move all the overloads into a partial class. For the same reason I have not created an extra overload for the async methods without a CancellationToken.
I've tried to implement this as least "invasive" as possible. Only IQuerySession and its implementation are extended, the magic happens in the new AdvancedQueryHandler class.
Future improvments might be: