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

Add a distinced Backend for MariaDb #1882

Open
johnkarasev opened this issue Oct 12, 2018 · 14 comments
Open

Add a distinced Backend for MariaDb #1882

johnkarasev opened this issue Oct 12, 2018 · 14 comments

Comments

@johnkarasev
Copy link

Just wondering if diesel supports MariaDB.

@weiznich
Copy link
Member

weiznich commented Oct 12, 2018

MariaDB is more or less supported through the MySql backend.

In the long term we want to add a distinct MariaDB backend that shares most of it implementation with the existing MySql backend.

If anyone is willing working on this feel free to claim that issue or drop a message on gitter.

(Changed the title of the issue to make more clear that we want to add a distinct backend.)

@weiznich weiznich changed the title Is MariaDB supported? Add a distinced Backend for MariaDb Oct 12, 2018
@virome
Copy link
Contributor

virome commented Oct 27, 2018

Spoke with weiznich on gitter and I'll be working on this one

@ian-p-cooke
Copy link

@virome are you still working on this? I might want to do something similar to support TiDB and would like to see how you refactor things.

@virome
Copy link
Contributor

virome commented Feb 27, 2019

@ian-p-cooke Unfortunately, I ended up not having much time to work on this. If no one else wants to take it, I still would like to finish it at some point.
If you're ready to go with your work, I wouldn't wait for me.

@p-alik
Copy link
Contributor

p-alik commented Apr 29, 2020

@saresend
Copy link

Is this still available? I'd be interested to give it a go

@weiznich
Copy link
Member

@saresend This is still an open issue, so feel free to work on this. Be warned that this requires likely a complex large change to diesel itself.

@saresend
Copy link

Yeah that's fine, just want to double check you'd be willing to help answer questions / support this work

@weiznich
Copy link
Member

@tgross35 Let's move the discussion about a custom mariadb backend here:

Thanks for the response, seems like there's a couple reasons for a dedicated mariadb backend. What would be the bare minimum PR to get support moving in the right direction? It seems like duplicating diesel/diesel/src/mysql and updating the connection would be needed, but I'm not sure how many of the other sections of the repo would need to be touched just to get something going, or what a prioritized todo list would look like.

It's hard to tell what's the exact minimum PR for something like that, because as already written: We do not even have a specific design for that in mind. Keep that in mind for anything else that follows. I would prefer something that does not duplicate that much code, as that all is code that needs to be maintained. I would guess that there is no need to duplicate all of diesel/diesel/src/mysql. For example the connection/serialization/deserialization implementation can and should be shared between a potential mariadb backend and the existing mysql backend. I would likely start with the following approach:

  • Add a new mariadb type and implement Backend (and related traits) for this. Essentially that should duplicate this file. You can likely just copy that as a starting point, although we might want to tweak the SqlDialect impl at some point.
  • Add support for the new backend in the SqlType derive. Again that could copy most of the existing mysql implementation there.
  • Go through all the places where #[diesel(mysql_type = …)] is used and add an analogus #[diesel(mariadb_type = …)]
  • Make the MysqlConnection type generic over the backend and ensure that it only accepts Mysql and MariaDB as potential backends.
  • Check all mysql specific queryfragment impls and implement variants for mariadb
  • Check all the existing (de)serialization impls and make them applicable for both the mariadb and mysql backend.

All of that is quite a bit of work, so don't expect any fast changes there. Additionally we would need some testing strategy. We likely cannot afford testing another backend with the current setup.

@Mrodent
Copy link

Mrodent commented Jun 2, 2024

Posted a Stack Overflow question about Rust and MariaDB today. Anyone interested in developing this "backend for MariaDB" at the current time?

In comments to one of the answers there, weiznich makes a suggestion that in its current condition Diesel is compatible with MariaDB: "mysqlclient-sys does totally support linking to libmariadb". But if so, please can you provide a simpleton's section in your "getting started" guide which covers how to do this? In particular, if it involves installing MySQL on my system (W10), I am pretty apprehensive that a default MySQL install operation will result in carnage and mess up my MariaDB installation. So it would be important only to install those MySQL elements which are really necessary, in isolation.

But there are other things: setting up the appropriate environment variables, etc. Also the syntax of MariaDB has now drifted away significantly from MySQL, which is likely to cause problems. None of this is obvious.

Other significant factor: my OS is W10. Issue 3964 of March 2024 (detailing some degree of compatibility) is concerned exclusively with *nix.

Isn't MariaDB big enough now to deserve a worthy coverage... ?

@weiznich
Copy link
Member

weiznich commented Jun 3, 2024

@Mrodent As our issue tracker is a place to track issues and not a place to provide support I will answer only the part of your question that is actually related to the development of diesel. For anything else (especially anything that is related to your "setup problems") please use our support channels (or just refer to the answers already given in other places.)

Anyone interested in developing this "backend for MariaDB" at the current time?

We are still open to accept contributions here. Otherwise this is nothing that I plan to spend time on implementing it on my own in the next time as I personally do neither use mysql (nor mariadb). So this is something that needs to be implemented by an interested contributor.

Isn't MariaDB big enough now to deserve a worthy coverage... ?

It's not about the size of the database community, but rather about if people that use these database are interested in putting in the work to implement it. Please don't expect me to put in that work for something I won't use instead of fixing bugs in things I actually use or implement new features I actually need.
I believe that in the end it boils down to: The existing support for MariaDB via the existing MySQL backend is good enough for most of our users that nobody is willing to put in the required work to have a distinct backend. (I would estimate it with roughly several weeks of effort to implement that + getting it merged)

To summarize this all: Your contributions implementing this backend are welcome, but don't expect us to provide it on our own just because you've asked.

@Mrodent
Copy link

Mrodent commented Jun 4, 2024

@weiznich Thanks for your explanations about the way to proceed with this. I'm using the ODBC workaround for the moment. But when I have a bit more time I'll try to see how far I can get with Diesel + MariaDB + W10. If I have any success I'll report back with any findings, for anyone similarly facing this situation.

@ottok
Copy link

ottok commented Jul 10, 2024

@weiznich
Copy link
Member

@ottok We are happy to accept a PR that makes it more clear that you can also use libmariadb with the mysqlclient-sys.
Otherwise this is not really related to what's described in this issue as that's only a client side thing while this issue talks about supporting sql syntax send to the server.

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

No branches or pull requests

8 participants