Closed dallinbeutler closed 1 year ago
The weird thing here is that this is not SQLProvider error.
Are you ever starting or awaiting your List.executeQueryAsync
?
Is the type PersonnelID
some simple type alias or a complex type?
Quick response!
Sql.List.executeQueryAsync
and Sql.Seq.executeQueryAsync
everywhere to evaluate the collections. I'm using Elmish, and I'm getting the results as an async Cmd
. I can try messing around with that if it would help?PersonnelID
is just a simple type alias for int
I'm expecting this comes from somewhere else than the code visible, I do have a lot of joins and never seen this before. That's why I was thinking what if you test to do just |> Seq.toList
instead to get a better stacktrace.
What are crMembers
and ChatroomHeaders
? Are they the database tables directly from the context, or are they some other IQueryables executing some more logic there?
I'm expecting this comes from somewhere else than the code visible, I do have a lot of joins and never seen this before. That's why I was thinking what if you test to do just
|> Seq.toList
instead to get a better stacktrace.
I was getting weird issues with that, so I stopped trying it. I'll go do that now and report back!
What are
crMembers
andChatroomHeaders
? Are they the database tables directly from the context, or are they some other IQueryables executing some more logic there?let context = SQL_CHAT.GetDataContext(); let crMembers = context.Dbo.ChatroomMembers let ChatroomHeaders = context.Dbo.ChatroomHeader
for further reference here's some more info:
[<Literal>] let private connectionString = "Server={redacted...}; Database =Chat; Trusted_Connection=True;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False" type SQL_CHAT = SqlDataProvider<Common.DatabaseProviderTypes.MSSQLSERVER , ConnectionString = connectionString , CaseSensitivityChange = Common.CaseSensitivityChange.ORIGINAL , UseOptionTypes = true>
same story. Also here is more context about where this gets called:
open Bolero.Remoting.Server
open ChatDB
type API =
{
getGroupChats
:PersonnelID -> Async< (ChatroomID*string)list>
}
interface IRemoteService with
member this.BasePath = "/api"
type APIService
(ctx: IRemoteContext
, env: IWebHostEnvironment) =
inherit RemoteHandler<API>()
override this.Handler =
{
getGroupChats =
fun signedInAs ->
async{
return Queries.Select.getGroupRooms signedInAs
}
}
is the problem still there if you use "context.Dbo.ChatroomMembers" and "context.Dbo.ChatroomHeader" instead of capturing them to a temp variable?
Looks like that was it! successfully getting the joined tables now! Guess I was inadvertently creating weird references inside the context Type?
also, thanks so much! been racking my brain trying to fix this for a couple days
Good!
The error is coming from somewhere here: https://github.com/dotnet/fsharp/blob/main/src/FSharp.Core/Query.fs
which makes me wonder because your FSharp.Core 6.0.3
is not the latest.
Anyway, I usually tend to use the context tables directly.
I updated to 6.0.6 and the old code worked! Guess this is a valuable lesson in trying to create shorthand and not thinking about the implications
Describe the bug I'm trying to inner join two tables. I can successfully query one table, and the other table, but the join query always fails. query in question (fails):
one table (success):
other table (success):
error:
I've tried running
context.SubmitUpdates()
before the query but still get the same result. I feel like I've tried every variation, and am still failing. Am I missing something simple? I'd greatly appreciate the help!Desktop