Stupidly simple MySQLdb ORM for Python.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Norm is a stupidly simple "ORM" wrapper around MySQLdb. Or, that's the 
marketing pitch. Really, it's a few lines of code I wrote recently and I 
decided what the heck, I'll toss it up on GitHub so I have a place to 
keep throwing updates. If it is at /all/ interesting, feel free to pitch 
patches, criticism, or clever insults my direction.

Norm is licensed under the Apache Licence, Version 2.0

* Python 2.5+
* MySQLdb


    python build
    sudo python install

You can see a few test calls in the folder, but basically, it
goes like this:

    from Norm.model import Model
    from Norm.fields import *
    from Norm.connection import connection

    class Company(Model):
        id = PrimaryField()
        name = UnicodeField()
        state = UnicodeField(length=2, index=True)

    class Person(Model):
        id = PrimaryField()
        name = UnicodeField()
        company = ReferenceField(Company)    

    Company.people = ReferenceManyField(Person)

    # Verbose prints out the (unescaped) SQL
    connection.connect('mysql://test:test@localhost/test', verbose=True)

    corp = Company(name='Awesome Corp')
    corp.state = u'TX'

    joe = Person() = u'Joe Weatherston' = corp
    company = = u'New Company Name!'
    for company in Company.where({'name':u'New Company Name!'):
        for person in company.people.reverse():
    todd = Person.fetch_one({'name':'Todd'})

...or at least, that's the idea. Check out the file for detailed
syntax, or run it with '-v' to see the SQL statements.

It's baby, baby code, so don't be too critical. I just needed something simple 
to throw together an idea I had, and this fit the bill. There are a billion 
things I need to do with it, but again, any ideas are helpful. Although there 
are hundreds of alternate ORMs that would certainly be more worth your time. :)

I've also dropped the "logo" in the repo -- it's an Inkscape SVG, so have fun.