You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In .env, set DATABASE_URL to your SQLite Cloud DB connection string. (No need to install dotenv pkg.)
I tried 2 different connection strings: sqlitecloud://chtwalrwiz.sqlite.cloud:8860?apikey=lEN1TsCrDYlEFYia7VSjtme8HTFV3aHbXDy7rRBXEhM and sqlitecloud://upasana-admin:[email protected]:8860/chinook.sqlite. Both produced the errors documented in steps 3 and 4.
In schema.prisma, set datasource db's provider to sqlitecloud.
Run npx prisma db pull to connect to and introspect the DB.
Get error: Datasource provider not known: "sqlitecloud".
This makes sense, as Prisma ORM supports only these 6 datasource providers: postgresql, mysql, sqlite, sqlserver, mongodb, cockroachdb.
In schema.prisma, set datasource db's provider to sqlite.
Run npx prisma db pull.
Get error: Error validating datasource 'db': the URL must start with the protocol 'file:'.
Also makes sense, as a SQLite DB is an embedded file, not cloud server. Connecting a Prisma ORM client to a SQLite Cloud database directly isn't supported.
Notes
None of the other providers work/ are appropriate for this use case. All of them expect a different starting protocol, and the DB connection string uses sqlitecloud protocol.
GPT workarounds/ suggestions:
a. Set up a proxy server (i.e. Node.js/ Express). Connect the proxy to the SQLite Cloud database. Modify the Prisma client to interact with the endpoints exposed by the proxy server, which would handle queries and send responses back to the client.
b. Use a different ORM or DB client. sqlite3 or better-sqlite3 might be adapted to work with SQLite Cloud.
c. Migrate SQLite Cloud DB(s) to a Prisma-supported provider.
(a) may be viable, but to be really useful, I'd/ we'd basically have to recreate the entire ORM API in Express.
(b) means give up using Prisma.
(c) means give up using SQLite Cloud.
Validation/ Reproduction Steps
.env
, setDATABASE_URL
to your SQLite Cloud DB connection string. (No need to installdotenv
pkg.)sqlitecloud://chtwalrwiz.sqlite.cloud:8860?apikey=lEN1TsCrDYlEFYia7VSjtme8HTFV3aHbXDy7rRBXEhM
andsqlitecloud://upasana-admin:[email protected]:8860/chinook.sqlite
. Both produced the errors documented in steps 3 and 4.In
schema.prisma
, set datasource db'sprovider
tosqlitecloud
.Run
npx prisma db pull
to connect to and introspect the DB.Get
error: Datasource provider not known: "sqlitecloud".
This makes sense, as Prisma ORM supports only these 6 datasource providers: postgresql, mysql, sqlite, sqlserver, mongodb, cockroachdb.
In
schema.prisma
, set datasource db'sprovider
tosqlite
.Run
npx prisma db pull
.Get
error: Error validating datasource 'db': the URL must start with the protocol 'file:'.
Also makes sense, as a SQLite DB is an embedded file, not cloud server. Connecting a Prisma ORM client to a SQLite Cloud database directly isn't supported.
Notes
sqlitecloud
protocol.a. Set up a proxy server (i.e. Node.js/ Express). Connect the proxy to the SQLite Cloud database. Modify the Prisma client to interact with the endpoints exposed by the proxy server, which would handle queries and send responses back to the client.
b. Use a different ORM or DB client.
sqlite3
orbetter-sqlite3
might be adapted to work with SQLite Cloud.c. Migrate SQLite Cloud DB(s) to a Prisma-supported provider.
(a) may be viable, but to be really useful, I'd/ we'd basically have to recreate the entire ORM API in Express.
(b) means give up using Prisma.
(c) means give up using SQLite Cloud.
Related Issue(s)
sample content / JavaScript & Prisma
Screenshots & Videos
N/A.
I'd attach my own project to this comment, but GitHub doesn't allow it.
The text was updated successfully, but these errors were encountered: