Mischa
03/21/2022, 12:18 PMcargo build
in prisma-engines
- do I need to specify my locally built library in PRISMA_QUERY_ENGINE_LIBRARY
when running npx prisma generate
?
If I pass in the query engine dylib that got built:
[db:generate] Error: Unable to require(`/Users/cyber/dev/prisma-engines/target/debug/libquery_engine.dylib`)
[db:generate] Invalid or unexpected token
[db:generate] npm ERR! Lifecycle script `generate` failed with error:
I want to test my changes to DMMF generation locally and am not clear on how to do thisjanpio
janpio
Mischa
03/22/2022, 9:06 AMMischa
03/22/2022, 9:06 AMMischa
03/22/2022, 9:34 AMMischa
03/22/2022, 9:48 AMjanpio
janpio
Mischa
03/25/2022, 12:04 PMMischa
03/25/2022, 12:04 PMMischa
03/25/2022, 12:04 PMMischa
03/25/2022, 12:04 PMMischa
03/25/2022, 12:05 PMMischa
03/25/2022, 12:17 PMdwarfdump /Users/cyber/dev/platform/packages/infra/.build/cdk.out/asset.9644c9f988f239064766cfec2a8895a7bca252c383690784fa5ea2231da01b8d/nodejs/node_modules/@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node|wc -l
505815
janpio
do the clients assume that the absence of a value in DMMF is "false" or do they explode?Not sure, we could figure that out. But that might not be true for community generators that also depend on the dmmf value they get during the generation step.
janpio
and is there any downside to skipping the JSON.parse(dmmfString) step? (separate optimization)The Client needs the parsed JSON and not a textual representation, so that is important.
janpio
also wondering... maybe it would shrink the engine size if debug symbols were stripped?Yes - but at the cost of making all the stack traces pretty useless unfortunately. We rely on these to figure out where things go wrong and why. We have not come up with an in between solution that would not have that disadvantage unfortunately.
Mischa
03/25/2022, 8:28 PMThe Client needs the parsed JSON and not a textual representation, so that is important.so is the change to this file kosher? https://github.com/prisma/prisma/pull/12454/files#diff-c932f51b29bd2edde3fcd294d529cba543d23e89c3b7a1403b19ec91f3c59803 I could make a PR with just that change
janpio
dataproxy
only. That code path s not used with the normal engine.Mischa
03/25/2022, 8:46 PMbuildCompressedDMMF
was used for dataproxy
Mischa
03/25/2022, 8:46 PMbuildUncompressedDMMF
janpio
janpio
const dmmfString = "{\"datamodel\":{\"enums\":[{\"name\":\..."read\":[],\"write\":[\"runCommandRaw\"]}}}"
const dmmf = JSON.parse(dmmfString)
exports.Prisma.dmmf = JSON.parse(dmmfString)
janpio
index.js
Mischa
03/27/2022, 12:14 AMMischa
03/27/2022, 12:15 AMjanpio
index.js
look like?janpio
parse
twice thing baffled me as well, but is explained in a code comment somewhere. Something how internal object is copied or something.Mischa
03/27/2022, 3:28 PMMischa
03/27/2022, 3:29 PMjanpio
Json.parse
?
I remember some benchmarking of huge JS objects vs. parsing Json strings (parsing might be faster as it has far less options than the actual object and it is clear that the outcome only will be data from the outset).Mischa
03/27/2022, 7:22 PMMischa
03/27/2022, 7:23 PMjanpio
Mischa
03/28/2022, 11:54 AMMischa
03/28/2022, 12:27 PMMischa
03/28/2022, 12:27 PMMischa
03/28/2022, 12:27 PMMischa
03/28/2022, 12:27 PMfalse
values from dmmf:Mischa
03/28/2022, 12:28 PMMischa
03/28/2022, 12:29 PMjanpio
Mischa
03/28/2022, 12:33 PMjanpio
Mischa
03/28/2022, 1:04 PMMischa
03/28/2022, 1:04 PMMischa
03/28/2022, 1:05 PMjanpio
janpio
Mischa
03/28/2022, 1:40 PMjanpio
Mischa
03/28/2022, 1:45 PM