Skip to content
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

Merged
merged 1 commit into from
May 22, 2023

Conversation

colombod
Copy link
Member

@colombod colombod commented May 22, 2023

Addresses issue #2902

@@ -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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same rename suggestion.

Copy link
Member Author

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],
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Member Author

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()
Copy link
Contributor

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.

Copy link
Member Author

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) &&
Copy link
Contributor

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
@colombod colombod force-pushed the variable_explorer branch from ff95806 to 2edfdd6 Compare May 22, 2023 21:52
@colombod colombod merged commit cc3a2d3 into dotnet:main May 22, 2023
@colombod colombod deleted the variable_explorer branch May 22, 2023 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Storing SQL or KQL result set to a variable seems to cause variable explorer to stop working
3 participants