-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Cloudflare's new SQLite database D1 #13310
Comments
That would be a really great feature to have |
Just came here for this. This will be epic! |
D1 is based on SQLite so it may work by default? Edit: nevermind (see this HN comment) |
Can we expect to see a first iteration in the near future, or should we not hold our breath? I am planning to port a few projects to run fully on Cloudflare D1 in the coming months, and no support from Prisma would mean that I have to start using other ORMs. |
As far as im aware D1 still isnt GA |
It's still closed beta. |
As per the new blog post from cloudflare at https://blog.cloudflare.com/whats-new-with-d1/
So, we can get the sqlite db locally & using that, we should be able to use prisma without any additional setup only on development. Just need to implement a connection for production |
Any guidance on how to create a connection for production? |
I could imagine creating a separate worker to act as a network adapter between Prisma and D1. Other option, if possible at all, is to pass the instance of D1 (provided via binding) directly to the prisma client. Notice, the first approach would allow to use D1 outside workers as well, so probably a more scalable option) At the same time, because the solution would involve workers, I could imagine Cloudflare recognising the need for network connections to the D1 and rolling out a more optimised solution. So, let’s wait a bit and watch where things move. Right now there is not much on guidance, because D1 is still in closed beta. [Now I've read their recent blog post on procedures, maybe there could be a way to provide Prisma client via the procedures binding, although, I believe the whole idea of procedures could be used as a more fine tuned abstraction then a simple ORM. To me it seems that a connector to D1 would be not worth its value. As of now, it does not seem like Cloudflare team would have something traditional and down to earth in mind. They work on their own serverless edge world which an ORM like Prisma would certainly limit a lot. Build new tools or wait for new tools to be built)] |
It looks like Cloudflare opened up the D1 beta today to more users. This would provide a lot of value. If anyone needs me to test anything and/or work on the adapter let me know. |
+1 for D1 support from Prisma. |
I think uceumice's comment is practical and interesting way how to integrate prisma-client to D1. Prisma-internal has DataProxyEngine and recommends it for serverless environments like Cloudflare Workers and Deno Deploy. maybe if it can self-host Data Proxy API and develop a module to access own database, it might be the first way to integrate with D1. |
D1 is now available as an open alpha, i'll be looking into possible ways to use Prisma without the production driver - like extracting the underlying query from the prisma client using the approach from #5026 (comment) |
@DaniAkash keep us posted! Also keen to hear official word from either Cloudflare or Prisma... I imagine, as Cloudflare offers a first-class S3 interface for R2, they would offer a first-class Prisma interface for Prisma. Relevant reading:
|
@laiso I agree that sounds like a good approach. I’m going to play around with it next week. |
I would also love to have Prisma support in d1, it would let me move my entire stack into cloudflare |
@balupton update on my personal project, I couldn't get the underlying Prisma queries effectively without sacrificing good DX. Ended up refactoring most of my code to kysely along with their D1 dialect. Similar approach was recommended for PlanetScale edge driver as well Looking forward to see how Prisma will support Cloudflare D1 in the future |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
There is any news about this ? |
No, not yet. We will post an update when we start work or have something to share or test. |
We hope that will be very soon! 😉 |
When you announced you would be partnering with Cloudflare and called "Data DX" I was hoping this would be included |
+1 |
Not to be that grumpy old person, but can I point out that commenting "+1" generates a lot of spam for those of us following many issues like this. To show your support, can you please react to the original issue with the 👍🏼 emoji? If you're just looking to get updates, you can do so without leaving a comment by using the "Subscribe" button near the top of this issue. Thanks for your understanding! ❤️ |
Hey, we at Prisma have been working on the foundations for Edge Functions support for the past few weeks - the basis that will be required for supporting Cloudflare D1. Soon, we'll have something to share and test! If you are interested in helping us, please respond to this super short survey and leave your email address so we can get in touch with instructions: https://pris.ly/survey/driver-adapter-d1 Thanks. |
Just subscribed to that survey. Hope that we'll get something soon. In this prisma docs it says that workers can't use TCP and that's why we need a data-proxy. That was true, but this isn't the case anymore (I guess you aware of this already, though). Which means the thing that's just missing is that we can connect to an internet URL instead of a |
I love Cloudflare eco system and Prisma. |
is there any news about this ? |
For everyone reading this at a later point in time, I haven't received any answer from the survey after 2 months yet and we haven't heard back from the prisma team about if my assumptions about what's needed are correct. I'd appreciate it a lot if a prisma staff member would update issues like this from time to time. I know that we are in no way entitled to that, I just think I speak for so many developers when I say that a little transparency about the status would be really appreciated. If not, we'll have to deal with that as well of course it's your product, not ours. Side note: I'd even be willing to put money where my mouth is if there was a possibility to support/donate to very specific work (for example making prisma compatible with d1 and ready to be used by cf workers). |
I think I can't wait for it. |
I understand that Cloudflare D1 is currently in beta, but it was generous usage limits. While notifications about this issue can be somewhat repetitive, it's crucial to keep the community informed about such developments, any news?. The support for Cloudflare D1 would indeed be a significant step forward for Prisma and its users. |
I asked this question on the prisma discord, they said no estimate date will have to wait for it but they are working on it. P.S - They said to fill in the survey they will add you on the wait list they will let us know if they have something |
I've tried building a D1 adapter, however, there are some pieces missing which I cannot figure out how to do (like infering types and transactions in general). If one of you knows D1 / Sqlite / Prisma Adapters better than me (which shouldn't be too hard 😅), feel free to check out the fork. I've enabled issues on that repository so we can keep the noise in this thread to a minimum 👍 |
Quick update: We are currently testing the D1 adapter with a selected number of users via an Early Access. If you want to participate, just go by https://pris.ly/survey/driver-adapter-d1 again and leave a response where you only select D1 as the database you are interested in an I can prioritize inviting you for this as well. Thanks! |
Hey, last week we released Prisma ORM version 5.12.x which includes support for Cloudflare D1, behind the preview feature flag
Please give it a try, and leave your feedback in our Cloudflare D1 feedback discussion. 🚀 |
Cloudflare have just announced their first relational DB D1 which is based on SQLite.
https://blog.cloudflare.com/introducing-d1/
Would be awesome if Prisma could support it one day..
The text was updated successfully, but these errors were encountered: