groundhog icon indicating copy to clipboard operation
groundhog copied to clipboard

Implementing database driver

Open lierdakil opened this issue 6 years ago • 1 comments

Sorry if it's a wrong place to ask this kind of question, but I figured I could just as well ask directly.

So I have an HDBC driver to Microsoft SQL Server (based heavily on https://github.com/denisenkom/hsmssql, but with a few changes), which works well enough for my current needs. Now I want to bind groundhog to it, because using raw SQL isn't much fun at all. The question is, where do I begin? Database.Groundhog.Generic seems relevant, but at first glance it's unclear how exactly.

Looking at existing drivers, it would seem I need to define a few instances, like PersistBackendConn, DbDescriptor, etc, but there seems to be quite a lot of those, and it's not clear if all of those are mandatory, or only some.

Any pointers are appreciated.

lierdakil avatar Aug 26 '17 19:08 lierdakil

It would be great to have a new driver. From a high-level perspective, a driver consists of a connection datatype, connection functions, and the instances. SchemaAnalyzer and migrations are not mandatory. For a basic driver you would need DbDescriptor, SqlDb, and PersistBackendConn implementations. They are similar across the databases and address the syntactical differences.

Copying a bunch of code from an existing driver, such as MySQL and replacing the low-level binding calls with hsmssql ones would be a good starting point.

lykahb avatar Aug 27 '17 00:08 lykahb