[odb-users] design questions: c++ / python / sqlite

Boris Kolpackov boris at codesynthesis.com
Fri May 16 00:09:37 EDT 2014


Hi,

MM <finjulhich at gmail.com> writes:

> The question is general in itself: What should the order of things be?
> 
> 1. Step by step addition of odb pragmas to the C++ code to generate the sql
> tables?
> 2. Use of these tables from python, perhaps through some c++/python adapter
> like swig or some layer like that?

If you want ODB schema evolution support then ODB will have to generate
and maintain the database schema. Or, to put it another way, your C++
classes will have to be the "primary specification" of your data model.
The good news is that ODB generates pretty idiomatic SQL (in other words,
something that a database administrator would normally write by hand).
You can also customize the resulting schema with the various pragmas,
if you wish.

Regarding the Python part, I would suggest that you use one of the
Python database access packages (I have heard there are some good
ones) rather than try to access the C++ classes or the ODB API via
something like Swig, etc. Unless you for some reason need to modify
the C++ class state in the application's memory rather than in the
database. And in that case I would probably look into Boost.Python
first.

Boris



More information about the odb-users mailing list