Mailing List Archive

MS-SQL Server:Connectivity Help...
I would like to introduce Python with a bang to my new work group. Does
anyone have a driver to "insert" a single row into an MS-SQL server7.0
db. It appears from the main Python page, one must compile their own
ODBC drivers with VC++ to get the most robust solution. Can anybody
comment on this shortcoming. Getting Python to work for MS_SQL/NT would
be a big entrance.

Thanx--

Ed
MS-SQL Server:Connectivity Help... [ In reply to ]
There are three approaches.

1) Use the Win32 COM support to connect to SQL Server via ADO.
This is perhaps the most functional access to the database you're likely to
get in Python atm.
2) Use the Win32 extension ODBC module.
This only exposes a limited interface to the database, and has several known
annoying bugs. (Date/time type binding being the most annoying...)
3) Use the mxODBC extension.
This still only exposes a limited interface to ODBC, but fixes some of the
annoying bugs #2 currently has.
http://starship.python.net/crew/lemburg/
mxODBC also has a curious license which you should investigate before using.

Personally, I'd vote for #2 or #3 if you can.
ADO slows things down just a tad due to it having to convert to Unicode and
back again for sane use in Python.

Bill

> -----Original Message-----
> From: Edward B. Wilson II [mailto:zero@ecom.net]
> Sent: Tuesday, July 27, 1999 9:09 AM
> To: python-list@cwi.nl
> Subject: MS-SQL Server:Connectivity Help...
>
>
> I would like to introduce Python with a bang to my new work
> group. Does
> anyone have a driver to "insert" a single row into an MS-SQL server7.0
> db. It appears from the main Python page, one must compile their own
> ODBC drivers with VC++ to get the most robust solution. Can anybody
> comment on this shortcoming. Getting Python to work for
> MS_SQL/NT would
> be a big entrance.
>
> Thanx--
>
> Ed
>
>
>
MS-SQL Server:Connectivity Help... [ In reply to ]
"Edward B. Wilson II" <zero@ecom.net> wrote:

>I would like to introduce Python with a bang to my new work group. Does
>anyone have a driver to "insert" a single row into an MS-SQL server7.0
>db. It appears from the main Python page, one must compile their own
>ODBC drivers with VC++ to get the most robust solution. Can anybody
>comment on this shortcoming. Getting Python to work for MS_SQL/NT would
>be a big entrance.
>
I'd thoroughly recommend mxODBC. One huge advantage is the DateTime
objects, which offer capabilities to make database developers drool.
Furthermore, I'm pretty sure you don't lose any performance using
Microsoft ODBC drivers for Microsoft's own database!

You can do two lines of Python to grab a whole query into Python
variables; manipulate it; then do another line to insert the lot into
another table. One row at a time? pah!

You can also tell your colleagues that it is working with prepared
statements for optimum performance.

Regards,

Andy