473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"Correct" db adapter

Hi to all,

i have started a month ago to seriously studying Python. I am now
looking at the databases stuff
and i want the opinion of more experienced Python programmers (than
me) at the following :

I see that there are a lot of databases adapters on the net, some
following the DB-API 2.0 and some others do not. I want to use a db-
module that do not tie me down to a specific database and that fully
supports DB-API 2.0
Now i am using Sql Server but who knows about tomorrow.

I started using pyodbc and looking how i can e.x. call stored
procedure with arguments and all that stuff.
This is using ODBC syntac and i found enough info on the net.

Is the approach i took the "correct" one or is there a better db-
module so i can use ?

Thanks in advance

Jan 31 '07 #1
9 1888
Maybe you should take a look at sqlalchemy

king kikapu wrote:
Hi to all,

i have started a month ago to seriously studying Python. I am now
looking at the databases stuff
and i want the opinion of more experienced Python programmers (than
me) at the following :

I see that there are a lot of databases adapters on the net, some
following the DB-API 2.0 and some others do not. I want to use a db-
module that do not tie me down to a specific database and that fully
supports DB-API 2.0
Now i am using Sql Server but who knows about tomorrow.

I started using pyodbc and looking how i can e.x. call stored
procedure with arguments and all that stuff.
This is using ODBC syntac and i found enough info on the net.

Is the approach i took the "correct" one or is there a better db-
module so i can use ?

Thanks in advance
Jan 31 '07 #2
Maybe you should take a look at sqlalchemy
>
Hi to all,

i have started a month ago to seriously studying Python. I am now
looking at the databases stuff
and i want the opinion of more experienced Python programmers (than
me) at the following :

I see that there are a lot of databases adapters on the net, some
following the DB-API 2.0 and some others do not. I want to use a db-
module that do not tie me down to a specific database and that fully
supports DB-API 2.0
Now i am using Sql Server but who knows about tomorrow.

I started using pyodbc and looking how i can e.x. call stored
procedure with arguments and all that stuff.
This is using ODBC syntac and i found enough info on the net.

Is the approach i took the "correct" one or is there a better db-
module so i can use ?

Thanks in advance
SQLObject might be of interest to you:
http://sqlobject.org/ it is a DB-API 2.0 compliant ORM.
Jan 31 '07 #3
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.

Jan 31 '07 #4
king kikapu a écrit :
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.
FWIW, SQLAlchemy is not an ORM, but an higher-level API for SQL
integration. The ORM part is an optional feature built on top of this
API. But I'm not sure SQLAlchemy supports SQL Server anyway !-)
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.
AFAICT:

* there's an experimental MS SQL Server db-module:
http://www.object-craft.com.au/projects/mssql/

* the Win32 extensions offers support for ADO, but then it's not db-api
compliant

* unless you use adodbapi, but I don't know if it's still supported
(last release is 3+ years old):
http://adodbapi.sourceforge.net/

HTH
Jan 31 '07 #5
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
Jan 31 '07 #6
Ok, i see..

Thanks a lot all of you for the help. I know from my Win/.Net/Sql
Server expertise that odbc put a layer in the mix. That's why, for
example, in .Net we have a native SqlClient data provider that talks
to Sql Server directly.

But one of the reasons that i started learning Python, is to NOT to be
tied-up again with ANY company or specific product again (i had enough
MS addiction over these years...). So, based on this direction, i am
using pyodbc, which is DB-API2 compliant and i suppose that the code i
write this way, will have little changes to use another db in the
future.

I dig the net and found that there are several efforts for modules
specific to some databases but some of them are incomplete, faded, or
not db-api2 compliant.

So, i will check mxOdbc and see if there is a reason to use it over
pyodbc.

Feb 1 '07 #7
On 1 Feb 2007 02:13:01 -0800, king kikapu <ab********@panafonet.grwrote:

But one of the reasons that i started learning Python, is to NOT to be
tied-up again with ANY company or specific product again (i had enough
MS addiction over these years...). So, based on this direction, i am
using pyodbc, which is DB-API2 compliant and i suppose that the code i
write this way, will have little changes to use another db in the
future.
I don't know if this product will meet your needs, but I've read
recently on the Dabo list that they've added support for Microsoft SQL
Server. I don't work with databases, so I have no idea how this might
compare to what you're looking at, but I do know that in general their
code is solid and the authors are responsive. So you might want to
check out Dabo:
http://dabodev.com
--

# p.d.
Feb 1 '07 #8
Bruno Desthuilliers wrote:
king kikapu a écrit :
>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.

FWIW, SQLAlchemy is not an ORM, but an higher-level API for SQL
integration. The ORM part is an optional feature built on top of this
API. But I'm not sure SQLAlchemy supports SQL Server anyway !-)
>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.

AFAICT:

* there's an experimental MS SQL Server db-module:
http://www.object-craft.com.au/projects/mssql/

* the Win32 extensions offers support for ADO, but then it's not db-api
compliant

* unless you use adodbapi, but I don't know if it's still supported
(last release is 3+ years old):
http://adodbapi.sourceforge.net/

HTH
There's also pymssql <http://pymssql.sourceforge.net/which works well
enough most of the time.

Feb 2 '07 #9
Thank you all!

Feb 2 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: CLEAR-RCIC | last post by:
Hello All, I wrote a .dll that programatically maps two network drives and copies files from one drive to the other. The .dll works fine when using an .exe to call the .dll. When I call the...
53
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document,...
3
by: Mitchell Vincent | last post by:
I've been somewhat confused about what the "proper" place is to store data files (like file based databases) for my applications. With all the different "special" folders available, which is the...
50
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>...
4
by: metaperl | last post by:
I work at a place which is currently running SQL 2000, but they are planning to migrate to 2k5. I was thinking that this is the perfect opportunity to fix all the weaknesses we have had in our data...
4
by: chaitu | last post by:
Hi guys, I've written a parallel build program (in Perl) that takes a pre-computed dependency tree of many projects in 2 visual studio .net 2003 solution (.sln) files here at my company, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.