ClickHouse/clickhouse-cpp

Plans to provide a C Wrapper?

onguntoglu opened this issue · 5 comments

Are there any plans to provide a C wrapper over the existing C++ driver/client?

If not, what are my options apart from using the C++ library?

Enmk commented

Hi @onguntoglu, I am not aware of any such plans. May I ask you why exactly do you need such a library?

If not, what are my options apart from using the C++ library?

Maybe there is something developed by community, but that depends on your use-case.

Hi @Enmk, I am currently building a real-time application in C which receives 50 MSamples/s (in batches of 1M samples every 20ms) from a testbench and processes the data (filtering, downsampling and some transformations), and I need a system to record all this data and query it for further analysis at a later time

All the other database solutions did not meet the hard real-time requirement, I read/heard good things about Clickhouse and played with the web-interface a little bit and thought I'd try it out. There are a lot of parts to the application which are entirely written in C, so pulling in C++ is kind of painful (for me at least) and admittedly C++ is not my forte.

Enmk commented

Sorry @onguntoglu, but I am not aware of no plans for C-style library. Perhaps you can take an inspiration from how other c-projects are interfacing with clickhouse:

Hi, I have found a workaround:
I wrote a separate application in C++ which receives the data over ZeroMQ and inserted the data using the C++ library. It is working okay as far as I can observe, so I am no longer looking for a C wrapper.
Thank you for the fast response and the links!

If you would still prefer using a C wrapper (or for anyone in the future checking this), I made one here https://github.com/moaazassali/clickhouse-cpp-c-bridge

It covers almost everything from clickhouse-cpp with full testing. The few missing features are minor like query progress and server log callbacks, but they will be added shortly.