[CentralOH] Generating C++ / Java Objects from Django...
josh at globalherald.net
Fri Sep 10 16:23:30 CEST 2010
Does anyone have a use for a Django utility that will generate C++,
Python, and Java objects from a Django model? The objects are
serializable between all three languages.
Basically I've done the following. I hooked into the Django SQL table
creation rountines to also generate a Google Protocol Buffers file (.proto
file) describing the Django model. Then, my script will use the Protocol
Buffers compiler to compile the .proto file into C++, Python, and Java
I'll probably release it under the GPL some time in the near future - it
works now but it's not perfect. I wrote this to help with a middleware
product I'm developing. With this utility, I use Django to look at a
Postgres databse with a lot of tables, and then I can very easily create
C++ objects from those tables. Using the SOCI C++ library I can then very
easily send instances of those objects right to the database... and since
it's based on Protocol Buffers, I have a lightweight protocol with which I
can send the objects back and forth over the wire.
GlobalHerald.NET, the Smarter Social Network! (tm)
More information about the CentralOH