-
Notifications
You must be signed in to change notification settings - Fork 397
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
Fix issues with stored SQL or KQL queries not showing in variable explorer #2995
Conversation
src/Microsoft.DotNet.Interactive.Kql.Tests/KqlConnectionTests.cs
Outdated
Show resolved
Hide resolved
@@ -336,6 +334,30 @@ public async Task It_can_store_result_set_with_a_name() | |||
.Be(1); | |||
} | |||
|
|||
[MsSqlFact] | |||
public async Task Stored_query_results_are_listed_in_requestValueInfos() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same rename suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -374,7 +374,7 @@ Task IKernelCommandHandler<RequestValueInfos>.HandleAsync(RequestValueInfos comm | |||
var valueInfos = QueryResults.Keys.Select(key => | |||
{ | |||
var formattedValues = FormattedValue.CreateSingleFromObject( | |||
_variables[key], | |||
QueryResults[key], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to be storing these in separate buckets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed my mind : yes should be one, merged that behaviour
@@ -260,7 +260,7 @@ Microsoft.DotNet.Interactive.SqlServer | |||
protected System.Boolean CanDeclareVariable(System.String name, System.Object value, ref System.String& msg) | |||
public System.Threading.Tasks.Task ConnectAsync() | |||
protected System.String CreateVariableDeclaration(System.String name, System.Object value) | |||
protected System.Collections.Generic.Dictionary<System.String,System.Collections.Generic.IReadOnlyCollection<Microsoft.DotNet.Interactive.Formatting.TabularData.TabularDataResource>> get_QueryResults() | |||
protected System.Collections.Generic.Dictionary<System.String,System.Object> get_Variables() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exposing these as dictionaries mean they can be directly updated programmatically, bypassing other ways of declaring a variable. I'm not sure we want that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, removed access and added a StoreQueryResult method (protected)
@@ -345,7 +335,7 @@ async Task IKernelCommandHandler<RequestCompletions>.HandleAsync(RequestCompleti | |||
|
|||
public bool TryGetValue<T>(string name, out T value) | |||
{ | |||
if (QueryResults.TryGetValue(name, out var resultSet) && | |||
if (_variables.TryGetValue(name, out var resultSet) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah was the bug basically that we (inadvertently) used the wrong dictionary?
improve test Update src/Microsoft.DotNet.Interactive.Kql.Tests/KqlConnectionTests.cs Co-authored-by: Jon Sequeira <[email protected]> pr feedback collapse variables and query results update contracts api remove access to the dictionary changes rename api
ff95806
to
2edfdd6
Compare
Addresses issue #2902