[Monetdb-developers] python adapter: registering new Monetizer types?
Hi, 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 psycopg2.extensions.register_adapter(). 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: Database.register_adapter( type(SafeUnicode), 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. Thanks, Mark
On Tue, Jun 29, 2010 at 8:23 AM, Mark Bucciarelli
I'm working on the Django adapter again, and have run into a snag.
Gijs, I figured out a decent workaround [1]. I'm all set, thanks. Thanks, m [1] http://github.com/mbucc/monetdb-python/blob/master/django_monetdb/cursorwrap...
On Jun 29, 2010, at 6:49 PM, Mark Bucciarelli wrote:
On Tue, Jun 29, 2010 at 8:23 AM, Mark Bucciarelli
wrote: I'm working on the Django adapter again, and have run into a snag.
Gijs,
I figured out a decent workaround [1]. I'm all set, thanks.
maybe a good idea to add a register_adapter in the future, but for now we try to keep the python API as minimal as possible. Your solution seems a good one for now ;) Great work on the django monetdb API btw, are you actually using it for something? - gijs
On Tue, Jun 29, 2010 at 5:34 PM, Gijs Molenaar
Great work on the django monetdb API btw,
Thanks. It's working well for us, but it's not in production yet, so I haven't announced it. Though someone in the UK forked the github project already. !?!
are you actually using it for something?
We are building an event recommendation engine. There's lots of event data out there to store, sift, and sort through. Thanks, m
On Jun 29, 2010, at 11:44 PM, Mark Bucciarelli wrote:
On Tue, Jun 29, 2010 at 5:34 PM, Gijs Molenaar
wrote: Great work on the django monetdb API btw,
Thanks. It's working well for us, but it's not in production yet, so I haven't announced it. Though someone in the UK forked the github project already. !?!
are you actually using it for something?
We are building an event recommendation engine. There's lots of event data out there to store, sift, and sort through.
Interesting, please keep us updated with your progress. - gijs
participants (2)
-
Gijs Molenaar
-
Mark Bucciarelli