is it possible to develop a python binding of the cppdriver

6 views
Skip to first unread message

Fly Stone

unread,
Jul 10, 2017, 9:28:09 AM7/10/17
to DataStax C++ Driver for Apache Cassandra User Mailing List
hi all,

instead of using python driver (where libev does not support windows), is it possible to build a python extension on top of the cppdriver?

Anyone can give a hint about the feasibility or possible difficulties?

many thanks!

Sandeep Tamhankar

unread,
Sep 5, 2017, 7:51:19 PM9/5/17
to DataStax C++ Driver for Apache Cassandra User Mailing List

I have no experience developing native extensions in Python (actually, I don't have much Python experience in general), but I have worked on the PHP driver, which *is* a wrapper around the cppdriver. I think the most difficult issue you'd have to worry about with writing a Python wrapper is handling asynchronous calls: if you are fine with executing async calls and waiting on future's when you really want the result, I think you're fine. If, however, you want to make async calls and have (Python) callbacks invoked when the calls complete, I suspect you'll have a lot of trouble.

I think at a minimum, you'd have to create wrappers for the cluster, session, and future management functions. You'll need bindings for working with complex types that your application uses (e.g. tuple, list, set, etc.). You will need support for prepared statements and get row results from synchronous calls (or from waiting on a future).

If you go forward with this, I'd strongly recommend doing it incrementally. Start with connecting to a cluster with no creds and default load balancing policy, and execute a "select key from system.local"; doesn't get much simpler than getting a string value from the db! Then work your way up to other column types.

Finally, if you get stuck, you can look at the PHP driver code. It might have a solution to whatever you run into.

Good luck!
-Sandeep

Reply all
Reply to author
Forward
0 new messages