[DB-SIG] Table Oriented Programming

Federico Di Gregorio fog at initd.org
Sat Jan 29 22:51:54 CET 2005

Il giorno sab, 29-01-2005 alle 14:13 -0600, Ian Bicking ha scritto:
> Federico Di Gregorio wrote:
> > Il giorno ven, 28-01-2005 alle 15:11 -0600, Ian Bicking ha scritto:
> > 
> >>It doesn't use bound parameters like ?, instead it does all the SQL 
> >>generation itself including quotation.  So it has to know what database 
> >>you are using to actually create the SQL, like "mysql", "postgresql", etc.
> > 
> > 
> > This is.. er.. "horrible". PostgreSQL supports a *lot* of different
> > types and the only way to support them all is to let the driver do the
> > quoting (possibly with the user adding its own quoting rules, see
> > PEP-246 adapt() in psycopg 2). I suppose your driver is not quoting
> > PostGis or or even simple geometrical types mapped to Python instances,
> > right?
> No, but it could, as it has hooks for new types of data.  I'm not saying 
> its the best technique, but then psycopg's technique isn't all that 
> great either (falling back on __repr__ is particular bad, IMHO).

That was the old psycopg. psycopg 2 will fail on unknown types. Anyway,
each backend has its own peculiarities and the right way to cope with
them is the driver, not the ORM. Hey, I *love* SQLObject (apart from the
primary key support); I am just saying that quoting in the ORM is much
more error prone that leaving that to the driver.


More information about the DB-SIG mailing list