deta icon indicating copy to clipboard operation
deta copied to clipboard

Support for MySQL

Open accu-knauthg opened this issue 4 years ago • 3 comments

deta-lib looks great. Only downside is I have some databases that are MySQL. I could convert them to PostgreSQL, or I could help add MySQL support to deta-lib, if that isn't already part of your plan. If I were to do so, any pointers? I've looked over the source code, so I have a rough idea of how I'd proceed, but if you have any pointers, I'm all ears.

accu-knauthg avatar Jan 29 '21 14:01 accu-knauthg

Sorry, above comment should have been from gknauth (personal), not work persona.

gknauth avatar Jan 29 '21 14:01 gknauth

I don't personally use MySQL so any help adding it would be appreciated! As for pointers:

  • I'd start by adding a dialect that, like the other two, uses the "standard" dialect and interjects where the MySQL syntax differs. The "standard" dialect's make-expr-emitter and make-stmt-emitter both take trampolines as arguments so that when they recur, they call the trampolines instead of themselves and the trampolines then get to decide whether or not to interject and emit special syntax where the derived dialect might differ.
  • Probably, most of the types we support out of the box will work the same for MySQL as they do for Postgres so you'll have to go through types.rkt and change any places where we match on 'postgres to (or 'postgres 'mysql) or add new branches where MySQL expects a different {ser,de}serialization format.
  • I'd at least update the query suite to run against MySQL here. For CI, you can add a MySQL service like we have for PostgreSQL here. Don't forget to set the env vars here.
  • I'd add a column for MySQL to the support matrix in the documentation.

I hope that helps!

Bogdanp avatar Jan 29 '21 18:01 Bogdanp

That does help, thanks!

gknauth avatar Jan 30 '21 14:01 gknauth