peewee + dbslayer
Thank you, I'm glad you're enjoying peewee!

I hadn't heard of dbslayer so I took a look at it... I am pretty sure i would never recommend anyone use dbslayer... but of course if you wanted to build an adapter I think it would be possible.

This is a good place to start: http://peewee.readthedocs.org/en/latest/peewee/database.html#writing-a-database-driver

You would need to implement a subclass of database, probably `MySqlDatabase`.  Since you're working with http you will need to implement or work around the various db-api 2.0 calls that peewee uses.

The apsw driver in "playhouse" has to wrap a number of db-api 2.0 functions, so that's a good place to look as well:
https://github.com/coleifer/peewee/blob/master/playhouse/apsw_ext.py

Good luck, let me know if you have any more questions.

:monkey_face: :bear: :rabbit:
 Hi there,

Thanks for the great feedback. Id be interested in hearing your opinion on
why not to use dbslayer? aside from the obvious security issues (which in
our case are partially solved by a closed network and specific access
routes). Our main attraction for it being clean simply load-balancing
(using cherokee).

all the best
Ross

On Fri, Jan 18, 2013 at 3:45 PM, Charles Leifer notifications@github.comwrote:

> Thank you, I'm glad you're enjoying peewee!
> 
> I hadn't heard of dbslayer so I took a look at it... I am pretty sure i
> would never recommend anyone use dbslayer... but of course if you wanted to
> build an adapter I think it would be possible.
> 
> This is a good place to start:
> http://peewee.readthedocs.org/en/latest/peewee/database.html#writing-a-database-driver
> 
> You would need to implement a subclass of database, probably MySqlDatabase.
> Since you're working with http you will need to implement or work around
> the various db-api 2.0 calls that peewee uses.
> 
> The apsw driver in "playhouse" has to wrap a number of db-api 2.0
> functions, so that's a good place to look as well:
> https://github.com/coleifer/peewee/blob/master/playhouse/apsw_ext.py
> 
> Good luck, let me know if you have any more questions.
> 
> —
> Reply to this email directly or view it on GitHubhttps://github.com/coleifer/peewee/issues/151#issuecomment-12424613.
 Sure thing!  And i'm happy to provide help when you start implementing.

The biggest detractors i see are:
- overhead of HTTP versus socket connections
- overhead of serialization to JSON and having to implement conversion between json & native python types
- limitations on response size or problems with large queries or responses

If it were me i would write a connection pool that also did load balancing.  This would get rid of the Http request/response cycle overhead and serialization overhead.

Hey there,

Firstly well done on this neat little orm.

I'm considering writing a peewee Database type to interface with dbslayer (JSON response interface) (would implement using "requests")

I was wondering if you are aware of anything like this? or if you had any pointers?
Best
Ross
