Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Go as c-shared library for Python #16

Open
alexnavis opened this issue Apr 11, 2019 · 7 comments
Open

Go as c-shared library for Python #16

alexnavis opened this issue Apr 11, 2019 · 7 comments

Comments

@alexnavis
Copy link

Hi,

Currently I'm using ChronixDB for a project. We need to query data from ChronixDB from our python code. I see 3 options

  1. Write our own python client.
  2. Call go or java executable and deserialise the response.
  3. Compile Go project as c-shared module to access from python.
    - Reference: https://dustymabe.com/2016/09/13/sharing-a-go-library-to-python-using-cffi/

Questions

  1. I don't have much experience on the 'go' part for point 3) and would be great to hear your thoughts on what is feasible.
  2. Any other thoughts or recommendation to achieve this with minimal effort?

Thanks,
Alex

@juliusv
Copy link
Contributor

juliusv commented Apr 11, 2019

@alexnavis Today I learned that you can compile Go code as C shared libraries :) But that also means I have zero experience with it. Sounds feasible though.

All the options are a reasonable bit of effort, so I would say do whatever seems least annoying in your context?

@alexnavis
Copy link
Author

:).

Sure thanks for the reply. To create the python client, is "chronix.go" good reference or the java client ?

@juliusv
Copy link
Contributor

juliusv commented Apr 11, 2019

@alexnavis TBH I wrote that Go client library as an external contractor two years ago and haven't followed Chronix much since then. @FlorianLautenschlager would be able to give you a better idea of whether anything in there is outdated, but back then it was a pretty basic client for our immediate requirements. The Java libraries might be more complete.

@alexnavis
Copy link
Author

@FlorianLautenschlager Any thoughts from your side ?

@FlorianLautenschlager
Copy link
Member

@alexnavis your suggested solution with the c-shared library sounds good (but I have no experience with that either).

Regardless, do you want to read and write or just read with the client? Reading is less complicated to implement. I would make the implementation dependent on this decision.

  1. Any other thoughts or recommendation to achieve this with minimal effort?

Query: Chronix can also serialize the time series data as JSON (that's not very fast at the moment) but allows easy integration.

Regardless, I can assist with the development.

@alexnavis
Copy link
Author

Hi @FlorianLautenschlager ,

Thanks for the reply and the information.

  • We want only 'read' from client. With only read, any specific recommendation ?

  • Thanks for offering to assist with the development. Will keep you posted once we start working on it. How shall I coordinate with you - through email or github issue ?

Thanks,
Alex

@FlorianLautenschlager
Copy link
Member

Hi @alexnavis,

We want only 'read' from client. With only read, any specific recommendation ?

I would suggest to write a plain python client as the read is not too complicated to implement even when using the protobuf protocol. Maybe a new repository within the chronix org (but it is up to you).

Thanks for offering to assist with the development. Will keep you posted once we start working on it. How shall I coordinate with you - through email or github issue ?

I would prefer github issues, so other can see whats happening.

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

No branches or pull requests

3 participants