[SQLObject] Final patch for 0.4 with unit tests
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: G. <fra...@cl...> - 2003-07-01 15:01:11
|
Hello,
I've made some tests around the features I added.
While testing, I had to add another change : cause of alphanum ID, table cr=
eation was wrong and insert failed.
So, that must be specified in the class with _idAlpha and _idLength attribu=
te.
Same for relation : joinFieldAlpha and otherFieldAlpha are used to specify =
this. I *know* that field size is missing, so intermediate table generation=
has hard-coded field size (16 caracter yet).
But, as Ian says that relation object design will move in 0.5, I haven't tr=
ied to specify size by another attribute (joinFieldLength and otherFieldLen=
gth by example) because *I* don't need to generate table at runtime (the da=
tabase is already generated when I launch my client)
class Pet(SQLObject):
_idAlpha =3D True
_idLength =3D 16
code =3D StringCol()
name =3D StringCol()
favoriteToyID =3D IntCol(foreignKey=3D'Toy')
_joins =3D [RelatedJoin('Toy', joinField=3D'code', joinFieldAlpha=3DTru=
e, joinColumn=3D'pet_code', otherColumn=3D'toy_code', otherField=3D'alphaCo=
de', otherFieldAlpha=3DTrue, intermediateTable=3D'pet_toy')]
class Toy(SQLObject):
alphaCode =3D StringCol(alternateID=3DTrue)
name =3D StringCol()
Note again that it works for *postgres only*
Fran=E7ois
|