[Monetdb-developers] python adapter: registering new Monetizer types?

Mark Bucciarelli mkbucc at gmail.com
Tue Jun 29 14:23:43 CEST 2010


I'm working on the Django adapter again, and have
run into a snag.  I think the Python MonetDB wrapper
may need a new method, but before building a patch
I wanted to share the idea and get your feedback.

The issue is this: Django uses the field type SafeUnicode.
Monetizer doesn't have a mapping for this, and thus
raises a ProgrammerError exception.  (This is unicode
that is safe to disply on an HTML page, and is used for
all slug fields, which are common in Django.)

The SQLite adapter handles this via  a register_adapter
method on the Database object.  PostgreSQL uses

MySQL Python adapter exposes a encoders() method
on the connection object.

It seems the cleanest solution would be to mimic
SQLite (if you want this for one connection, you most
likely want it for all connections), and be able to do
something like this:

        lambda s:unicode(s)

But it wasn't clear to me how to implement this.  Somehow
that call needs to make it into Montizer mapping dictionary.



More information about the developers-list mailing list