This is a bit off topic, but I thought some of you might find it useful.

I have been playing around with SQLAlchemy lately, and I really like it, but I feel like it needs a more declarative way to define object/ table maps. I have started on such a project, and I am calling it ActiveMapper.

I have my current efforts so far available in a SVN repository, If you are interested in helping out, please take a look at get back to me:

    http://cleverdevil.org/svn/activemapper/

Currently, it allows you to do most of the basic mapping in the following basic form:

class Address(ActiveMapper):
    class mapping:
        __table__   = 'address'
        id          = column(Integer, primary_key=True)
        type        = column(String)
        address_1   = column(String)
        city        = column(String)
        state       = column(String)
        postal_code = column(String)
person_id = column(Integer, foreign_key=ForeignKey ('person.id'))


class Preferences(ActiveMapper):
    class mapping:
        __table__        = 'preferences'
        id               = column(Integer, primary_key=True)
        favorite_color   = column(String)
        personality_type = column(String)


class Person(ActiveMapper):
    class mapping:
        __table__   = 'person'
        id          = column(Integer, primary_key=True)
        full_name   = column(String)
        first_name  = column(String)
        middle_name = column(String)
        last_name   = column(String)
        birth_date  = column(DateTime)
        ssn         = column(String)
        gender      = column(String)
        home_phone  = column(String)
        cell_phone  = column(String)
        work_phone  = column(String)
        prefs_id    = column(Integer,
                             foreign_key=ForeignKey('preferences.id'))
        addresses   = onetomany('Address',
                                colname='person_id', backref='person')
        preferences = onetoone('Preferences', colname='pref_id',
                               backref='person')


Anyway, I hope that I find some people interested in helping move this forward, and sorry for starting an off-topic thread.

--
Jonathan LaCour
http://cleverdevil.org


Reply via email to