Skip to content

fix(docs): refer wrong raw query methods in ORM > Using Raw SQL > TypeSQL#7867

Open
Hephaest wants to merge 1 commit intoprisma:mainfrom
Hephaest:prisma-client
Open

fix(docs): refer wrong raw query methods in ORM > Using Raw SQL > TypeSQL#7867
Hephaest wants to merge 1 commit intoprisma:mainfrom
Hephaest:prisma-client

Conversation

@Hephaest
Copy link
Copy Markdown
Contributor

@Hephaest Hephaest commented May 5, 2026

Summary

In Dynamic SQL Queries with Dynamic Columns section, the doc clearly mentioned:

When you need to create a query where the columns are determined at runtime, you must use the $queryRaw and $executeRaw methods.
But in the example, it uses:

const columns = "name, email, age"; // Columns determined at runtime
const result = await prisma.$queryRawUnsafe(`SELECT ${columns} FROM Users WHERE active = true`);

It looks counterintuitive to me, so I do check on my own. The search results confirmed my assumptions: the doc might refer to the wrong methods.

Proofs:

Under $queryRaw considerations>
image

Under $executeRaw considerations>
image

Summary by CodeRabbit

  • Documentation
    • Updated guidance for constructing SQL queries with dynamically determined columns.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@Hephaest is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8effac45-3173-43a1-ab31-f5af9f49f611

📥 Commits

Reviewing files that changed from the base of the PR and between 8db1147 and 9f40946.

📒 Files selected for processing (2)
  • apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/typedsql.mdx
  • apps/docs/content/docs/orm/prisma-client/using-raw-sql/typedsql.mdx

Walkthrough

Two versions of Prisma TypedSQL documentation are updated to recommend $queryRawUnsafe and $executeRawUnsafe methods instead of $queryRaw and $executeRaw when dynamically constructing SQL queries with runtime-determined columns.

Changes

Documentation Guidance Update

Layer / File(s) Summary
Documentation
apps/docs/content/docs.v6/orm/prisma-client/using-raw-sql/typedsql.mdx, apps/docs/content/docs/orm/prisma-client/using-raw-sql/typedsql.mdx
Recommended methods for dynamic column selection updated from $queryRaw/$executeRaw to $queryRawUnsafe/$executeRawUnsafe in the "Dynamic SQL Queries with Dynamic Columns" limitation section. Both v6 and current doc versions aligned with this guidance.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: correcting documentation that was referring to the wrong raw query methods in the TypeSQL guide.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant