Supaglue + Prisma
Supaglue hands off synced data to you using a database as the interface (regardless of who hosts it). This recipe shows how to use Prisma ORM to read the synced data quickly.
There are two recommended ways to use Prisma with your application depending on whether your Supaglue Destination is your production database:
- If you're using a Supaglue-hosted Destination or a Destination different from your production database, follow the multiple databases section below.
- If you're using a Supaglue Destination that's the same as your production database, follow the multiple schemas section below.
Multiple databases
We recommend you generate a second Prisma client - one for your production database and one for the Supaglue Destination database.
You can follow Prisma's documentation on generating clients to do this. There is also a helpful GitHub comment on how to do it.
This way, you continue to use your existing client as is and follow the workflow for using Prisma with an existing project for the Supaglue Destination database.
Multiple schemas
We recommend you use Prisma's multiSchema
feature to continue using your existing Prisma client.
This approach involves turning on the multiSchema
preview feature, declaring a Supaglue schema in your schema.prisma
file, and introspecting Supaglue's models so you can continue to use your existing client for both your current models and Supaglue's models.