-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Make SQL Server scaffolding compatible with Azure Data Explorer #34832
Conversation
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
What are the results of
and
|
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
@barnuri This looks valuable, I will get this added to EF Core Power Tools, including the CLI edition |
@dotnet-policy-service agree |
What tool are you using for coding this? I had a typo in my guess at spelling 😄 |
using this scaffold cmd
oh you mean which ide i used, i used github web ^^ |
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.
LGTM
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Show resolved
Hide resolved
src/EFCore.SqlServer/Scaffolding/Internal/SqlServerDatabaseModelFactory.cs
Outdated
Show resolved
Hide resolved
I implemented a fix for this in the latest daily build, would be grateful if you could try it out. |
how can i use it ? |
@barnuri Something similar, yes. Have a look at the readme here: https://www.nuget.org/packages/ErikEJ.EFCorePowerTools.Cli/9.1.409-nightly |
steps:
got this error now
|
I'm not against doing tweaks in EF to accomodate Azure Data Studio, but we need a wider understanding here, i.e. how compatible is ADS really with SQL Server, how usable will it be with EF, etc. Just adding scaffolding capabilities - either to EF or to the Power Tools - doesn't make much sense if nothing is going to work after that's done. |
Agree, but a way to find out is to enable queries against it based on a Power Tools generated DbContext - as an experimental feature.. |
And it is Azure Data Explorer ( ADX) |
I don't think any sort of scaffolding or Power Tools support is needed here, just in order to test what ADX supports and whether it makes sense to use EF with it... That's just something that someone needs to investigate. But of course if you want to add a feature to Power Tools sure :) |
after adding those fixes, i got full scaffolding of my db, the reason is to use adx via sql because adx doesnt have c# linq support and doesnt planning to have in the near future, and i want to connect it to some automatic tools like hot chocolate (graphql) to build strong api |
@barnuri OK, but what are the actual SQL capabilities of ADX? The subquery above which you converted into a JOIN is a pretty bad sign of the SQL capabilities being very limited. |
you are right, but most of the time you dont use sub queries anyway because its had bad performance, and its support the most common simple queries that we need and always we can also make it better it adx too |
Is it only subqueries? Is there documentation anywhere saying what's supported and what isn't? |
Also note that tests seem to be failing. |
yeah missed some copy paste from EFCorePowerTools
from my experience yes, i verified all the basic and looks like its works great (select, where, joins group by) |
@roji @cincuranet Docs on Kusto SQL limitations: https://learn.microsoft.com/en-us/azure/data-explorer/t-sql#coverage |
test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs
Outdated
Show resolved
Hide resolved
AND [ep].[minor_id] = 0 | ||
AND [ep].[class] = 1 | ||
AND [ep].[name] = N'microsoft_database_tools_support' | ||
AND [o].[object_id] NOT IN (SELECT [ep].[major_id] |
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 work here @barnuri! This indeed replaces a correlated EXISTS subquery with a non-correlated IN. I'd actually accept that as an improvement regardless of the SQL limitations of ADX - we did this improvement in EF's query generation in 8.0, both because the SQL more clearly matches the intent and because it can be (dramatically) faster on some databases (but not on SQL Server).
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.
thanks :)
and thanks for the collaboration 💪🏾
Let me do a little smoke testing on the Power Tools PR that resembles this |
Merged for 10, thanks for your contribution @barnuri! |
Fixes #34833