Re: "Correct" db adapter



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
.



Relevant Pages

  • Re: "Correct" db adapter
    ... I think i do not need something like ORM, but just a db-module that i ... can "work" the database with it. ... usefull for this job. ...
    (comp.lang.python)
  • Re: "Correct" db adapter
    ... I think i do not need something like ORM, but just a db-module that i ... FWIW, SQLAlchemy is not an ORM, but an higher-level API for SQL ... But I'm not sure SQLAlchemy supports SQL Server anyway!-) ...
    (comp.lang.python)
  • Re: "Correct" db adapter
    ... I think i do not need something like ORM, but just a db-module that i ... The ORM part is an optional feature built on top of this API. ... But I'm not sure SQLAlchemy supports SQL Server anyway!-) ... the Win32 extensions offers support for ADO, but then it's not db-api compliant ...
    (comp.lang.python)