Here's a rework of the patch I posted a few weeks ago. It adds the
ability to create indexes along with the tables from within SQLObject.
To use it, you simply do something like:
class MyThing(SQLObject):
thing = IntCol()
other = IntCol()
idx = Index(thing)
idx2 = Index((thing, other), unique=True)
The implementation works for me, but there's a few warts in there. The
big one is that the Index object refers to Col objects, but ultimately
needs to find the mapping to SO_Col objects to get the dbName for each
column. For ForeignKey columns this is tricky, because they add the
'ID' to the end of the column name, but there doesn't seem to be a
record of the original name - I duplicate the code in _SO_ForeignKey
which does this, which isn't nice.
J
|