Re: "Correct" db adapter
- From: "Diez B. Roggisch" <deets@xxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 19:11:57 +0100
king kikapu wrote:
Thanks for the replies.
I think i do not need something like ORM, but just a db-module that i
can "work" the database with it.
I just want to know if pyodbc is the "correct" solution to do so or if
it is another db-module that is more
usefull for this job.
I think you've got something wrong. There is no such thing as a generic
DB-Adapter, except maybe from the mxODBC which pushes the abstraction to
the ODBC-layer.
If your app is DB-API2.0-compatible, you should be able to more or less just
use your code with different adapters. There are several ways to accomplish
a configurable way, but in the end it boils down to someting like this:
if is_postgres:
import psycopg2 as db
if is_mysql:
import MySQLdb as db
Then db can be used to connect and query the db. A thin layer on top of that
should maybe be written to cover different parameter-styles, but that
shouldn't be too hard.
Diez
.
- References:
- "Correct" db adapter
- From: king kikapu
- Re: "Correct" db adapter
- From: Laurent Rahuel
- Re: "Correct" db adapter
- From: Daniel Nogradi
- Re: "Correct" db adapter
- From: king kikapu
- "Correct" db adapter
- Prev by Date: Re: Sorting a List of Lists
- Next by Date: RE: Python tools to manipulate JARs ?
- Previous by thread: Re: "Correct" db adapter
- Next by thread: subway
- Index(es):
Relevant Pages
|