Keep control on your technologies, choose Free/Open Source Software for your enterprise.

Menu Text en

SQLObject

Developed by Ian Bicking and other contributors, SQLObject is a Python module that is very useful in accessing your MySQL or PostgreSQL databases as objects.

XSOLI has developed a class inheritance as a new feature for its internal needs. The source code was then shared with the project for the benefit of the community.

Here is an example of the Python code using the inheritance:

class Employee(InheritableSQLObject):

    name = StringCol(length=50, notNone=True)
    salary = DecimalCol(size=10, precision=2)
    department = ForeignKey("Department")


class Manager(Employee):

    bonus = DecimalCol(size=10, precision=2)

Two tables are thus created in your database with the corresponding fields. The “Manager” class inherits from the “Employee”, it retains all the properties of the former plus a “bonus”.

We invite you to visit the official SQLObject site for more details.