connect icon indicating copy to clipboard operation
connect copied to clipboard

feature: add api to be able to compile and use a custom `database/sql` driver with the `sql` components

Open gena01 opened this issue 6 months ago • 3 comments

I am able to compile a custom build of benthos with a database/sql compatible driver.

However I am unable to use it because of the enum field: https://github.com/redpanda-data/connect/blob/9867fe59bf2f388ccadf6a768fa2a760b26e6f9d/internal/impl/sql/conn_fields.go#L30

I wish it would be possible to add database drivers and use them with existing sql package.

gena01 avatar Jul 17 '25 18:07 gena01

Any reason this field is enum? Why not a regular string field?

P.S. Wouldn't there be an error if you are trying to use a driver that's not compiled in at the database/sql level?

gena01 avatar Jul 21 '25 17:07 gena01

Hey @gena01, can you add your driver to the enum in your custom build?

mmatczuk avatar Jul 22 '25 07:07 mmatczuk

He'd have to copy the whole internal/impl/sql folder as a custom plugin, which can feel a bit cumbersome. On the other hand, making the implementation generic such that it supports various drivers isn't straightforward because users might want to customise the placeholder style and the usage of transactions, so turning the driver field into a plain string will only work in some cases. Ideally, I think these connectors should maybe expose some Go API which users may call to register a new driver and specify placeholder style and usage of transactions.

mihaitodor avatar Jul 22 '25 10:07 mihaitodor