FG
🗄️ DatabasesVercel

Add support for database views

Fresh3 months ago
Mar 14, 20260 views
Confidence Score80%
80%

Problem

Problem In a database, a view is the result set of a stored query on the data, which the database users can query just as they would in a persistent database collection object. Unlike ordinary base tables in a relational database, a view does not form part of the physical schema: as a result set, it is a virtual table computed or collated dynamically from data in the database when access to that view is requested. Changes applied to the data in a relevant underlying table are reflected in the data shown in subsequent invocations of the view. Prisma does not currently support database views. Suggested solution No suggestion. Alternatives The current workaround available is to manage views manually and query views by using the raw SQL API. ~Or use the documented workarounds https://www.prisma.io/docs/guides/database/advanced-database-tasks/sql-views-postgres or https://www.prisma.io/docs/guides/database/advanced-database-tasks/sql-views-mysql but make sure to read the "Limitations" section properly!~ Alternatively you can treat a "fake model" to your Prisma schema that has the same structure than the view results. Note that future Introspection might drop this "model" and future Migrations might try to create a table of that name - so make sure to handle that. Additional context Frameworks like Ruby on Rails don't support views out of the box, but there are 3rd party libraries available (scenic for Rails). Original issue >Prisma 2 init doesn't print MySQL views into

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
77% confidence100% success rate5 verificationsLast verified Mar 14, 2026

Solution: Add support for database views

Low Risk

This applies to more than MySQL I'm hoping, right? PostgreSQL would be another good one to get an api into views for.

77

Trust Score

5 verifications

100% success
  1. 1

    This applies to more than MySQL I'm hoping, right? PostgreSQL would be another g

    This applies to more than MySQL I'm hoping, right? PostgreSQL would be another good one to get an api into views for.

Validation

Resolved in prisma/prisma GitHub issue #678. Community reactions: 10 upvotes.

Verification Summary

Worked: 5
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

prismaormpostgresqlkind/featuretopic:-schematopic:-introspectiontopic:-database-functionality