Skip to content
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

Investigate diesel #142

Closed
bonomat opened this issue Feb 15, 2023 · 4 comments
Closed

Investigate diesel #142

bonomat opened this issue Feb 15, 2023 · 4 comments
Assignees

Comments

@bonomat
Copy link
Contributor

bonomat commented Feb 15, 2023

For our databases (e.g. #26 ) we want to consider Diesel instead sqlx this time.

The goal of this ticket is to have a simple PoC setup with CRUD functionality

Things to look into:

  • can we have a swappable DB, e.g. can we switch postgres for sqlite?
  • how complex does the model get compared to sqlx?
  • any other obvious drawbacks?
@bonomat bonomat self-assigned this Feb 15, 2023
@1010Tom 1010Tom self-assigned this Feb 17, 2023
@1010Tom
Copy link
Contributor

1010Tom commented Feb 17, 2023

I've started with this today.
In case someone wants to have a look (cc @da-kami ) how to use diesel in a simple setup, please checkout this branch:
https://github.com/get10101/10101/compare/feat/orderbook?expand=1

Regarding the outlined questions

can we have a swappable DB, e.g. can we switch postgres for sqlite?

Short answer: it is not easily possible to write generic code which would allow us to use either sqlite or postgres.

Longer answer: diesel-rs/diesel#2384

how complex does the model get compared to sqlx?

So far I can't say much about this due to using very simple types.

any other obvious drawbacks?

It's sync but that shouldn't be a problem (imho)

@da-kami
Copy link
Contributor

da-kami commented Feb 20, 2023

Note: Have you considered using diesel-async?
At least for Posres it supports a full async connection. It's created by the creator of diesel.
(Very long discussion here: diesel-rs/diesel#399 - relevant comment here: diesel-rs/diesel#399 (comment))

Not saying that we will need it from the getgo, but with sync code we will limit the number of db connections that can execute to the number of threads (and a threadpool). I think for the app and sqlite that should be fine, I don't expect heavy load there, but for the Ordinator this might be a different story, as there will be more load.

We can roll with a sync implementation initially and can see :)

@1010Tom
Copy link
Contributor

1010Tom commented Feb 20, 2023

Note: Have you considered using diesel-async?

I don't see the need for async yet. I would assume that our db queries are super short running which should hopeflly hardly have an effect on the remaining application.

@bonomat
Copy link
Contributor Author

bonomat commented Mar 6, 2023

We decided to go with diesel for mobile #26 and the coordinator #27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants