feature(raw): Improve prisma.raw by re-exporting all of sql-template-tag#2311
feature(raw): Improve prisma.raw by re-exporting all of sql-template-tag#2311timsuchanek merged 3 commits intoprisma:masterfrom zachasme:improved-raw
Conversation
|
I also happen to need this! Did you manage to get some SQL syntax highlight at the same time? This is something that I would like to see improved in the vscode plugin. |
|
Thanks for the feedback, I've rebased on master, moved the exports to the module directly (instead of prisma instance) and added exports to |
| query = stringOrTemplateStringsArray[sqlOutput] | ||
| parameters = { | ||
| values: JSON.stringify(stringOrTemplateStringsArray.values), | ||
| __prismaRawParamaters__: true, |
There was a problem hiding this comment.
Hm, which part? :)
There was a problem hiding this comment.
Ah, this is the actual name used in the codebase.
You want this handled in another PR or this one?
There was a problem hiding this comment.
I believe another PR would be better. Getting this one merged and documented would be a big win, I really need it...
@timsuchanek @janpio
There was a problem hiding this comment.
Separate PR sounds better, indeed.
|
What else can I do to move this along? |
|
@zachasme thanks, so far there's nothing needed from your side. |
|
Thanks for the PR! I did a few changes about where to import stuff from, it's now building in our CI and will be available on alpha in 10 min. |
|
Wow thanks a lot guys! Good job on landing this |
When sending raw queries using
prisma.rawit would be nice to have access to all ofsql-template-tag.We had a specific query where we wanted to write the SQL by hand. But the current API is quite limited. Nesting and joining in particular from
sql-template-tagare very useful when composing complex queries.This PR simply re-exports the same API as a direct import, adds a case for
prisma.sqlinput toprisma.raw, and adds a simple test as well.