Replies: 6 comments 8 replies
-
I've converted this to an issue to a feature proposal discussion as that's not strictly a bug report at all. That written: I would open to accept a PR for such a connection implementation if it can be shown that the implementation is similar performant than the current sync diesel As a more general note: It's usually a bad idea to use a different database system for development and testing than for the production instance. You will miss bugs and subtle issues. |
Beta Was this translation helpful? Give feedback.
-
Perhaps instead of implementing an async sqlite there could be a generic AIUI, the main challenge with "just use the sync version" is that you need to sprinkle/remove a bunch of |
Beta Was this translation helpful? Give feedback.
-
I’ve seen there’s this crate which implements an async sqlite connection. https://github.com/ryanfowler/async-sqlite Edit: to give some context, I’m totally ok for using sqlite in production. It covers a lot of use cases where a database server might be overkill (IMHO, it’s overkill in many situations). That said, I agree that using different database engines for testing vs production is an anti-pattern. I don’t have enough expertise to craft a PR, but I’d be happy to contribute in any way. |
Beta Was this translation helpful? Give feedback.
-
Hi @weiznich, I started implementing sqlite support into diesel_async. As a first step I am trying the approach suggested by @quentinmit here #95 (comment), basically creating a SyncConnectionWrapper that adapts a Connection to an AsyncConnection. I understand you are not willing to implement this yourself but would appreciate your input in creating a proper implementation. The main blocking point is how to plug onto underlying Connection methods. The solution I can imagine would be creating a SqlQuery from the built SQL string and bind the BindCollector Buffers to it in the async task which would require tweaking the BindCollector, potentially adding a trait to expose its underlying data. Unfortunately I don't have much diesel/diesel_async expertise to find the most appropriate way according to waht you expect. If this doesn't look like the right approach, the next option would be to implement a Sqlite specific AsyncConnection re-using as much as possible from Diesel implementation. Could you please give me some ideas? I would really appreciate your feedback and knowledge. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I will put in my two cents and hopefully give @momobel some inspiration that I am looking for sqlite support as well. I'd like to write a service that supports both postgres and sqlite and would very much prefer to not have to copy paste every single query just without an |
Beta Was this translation helpful? Give feedback.
-
Thanks to @weiznich help, this is now possible with the SyncConnectionWrapper starting from diesel_async 0.5.0. |
Beta Was this translation helpful? Give feedback.
-
Setup
Versions
Problem Description
sqlite is not supported
What are you trying to accomplish?
sqlite is nice for development & testing, when a fill DB is overkill
Checklist
Beta Was this translation helpful? Give feedback.
All reactions