Parse a SQL source string into a python object.

Takes a source SQL string and parses it into a new class named name . The class is initialised with a database connection and has a method for each SQL statement.

Each SQL statement should take the form:

-- name: <name> -- optional documentation BODY %(parameter)s

For example given the SQL source:

-- name: test1 -- documentation test1 SELECT * FROM test -- name: test2 SELECT * FROM test WHERE x = %(y)s

we can produce this object:

Example = parse_object ( 'Example' , source ) connection = MySQLdb . connect ( ... ) example = Example ( connection ) example . test1 () example . test2 ( y = 1 )