K
Join ServerKysely
help
RawBuilder is not "Compilable"
How one should execute RawBuilders coming from (for example)
since they're not "Compilable" things? I know you can pass from
since I have a custom executor, but why is that? Is there another way?
sql`customsql`
since they're not "Compilable" things? I know you can pass from
sql`customsql`.execute({ getExecutor: () => executor })
since I have a custom executor, but why is that? Is there another way?
Message Not Public
Sign In & Join Server To View
sql`customsql`.execute({ getExecutor: () => executor })
this thing is valid ts/kysely code and it's working fine right now for executing sql
custom sql
queriesunder the hood, the rawBuilder
.execute
method compile itself and execute itself with the executor and the same queryId (given by its private properties)those methods are private as of now
I'd like to transform a rawbuilder to a CompiledQuery at least. I'm doing:
queryExecutor.compileQuery(rawBuilder.toOperationNode(), queryId)
Message Not Public
Sign In & Join Server To View
yeah I'm asking cause maybe there's a more than valid reason to hide them
don't know 🙂
So is that going to be compatible with Compilable interface?
not really, RawBuilder and sql template tag are "floaters" that require an external executor to compile/execute, while Compilable was created for query builders
but since you're passing the return type to the sql template tag, it'll return a CompiledQuery with that type
Yeah got it
Is there a reason why there was a private #queryId used twice, once for the compilation and once for the execution inside RawBuilders?
query id is passed around mainly for the plugin system which consists of 2 steps:
pre-query transformQuery
post-query transformResult
the id allows to communicate between the steps using WeakMaps
pre-query transformQuery
post-query transformResult
the id allows to communicate between the steps using WeakMaps
https://github.com/koskimas/kysely/pull/176 this PR could help with split of build, compile and execute vs. plugins
Might have to revisit it
Cause I got it working with my custom executor by self passing the executor to RawBuilder.execute. Now that I’m using toOperationNode I took care of using the same queryId for both compiling and executing, just to be sure and follow the private internal behavior of RawBuilders
So if RawBuilder get its own public compile then we should take care of using the same queryId then? Not sure how “secure” that would be
Message Not Public
Sign In & Join Server To View
I mean, during execution you pass a queryId to the executor execute method
What if that’s different from the one used during compiling? Since compiling is managed inside the raw builder
You don't have to anymore (pending release)
but yeah, query id should be part of the compiled query
Igal vs igalk is confusing as hell 😂 sorry I thought to be speaking to the same person so far
Same person, different devices
Message Not Public
Sign In & Join Server To View
🤯