[python-win32] MySQL connection/admin tool

Tim Roberts timr at probo.com
Mon Nov 28 19:15:26 CET 2011


Jacob Kruger wrote:
> Busy now building a sort of MySQL admin interface, and installed
> MySQL-python-1.2.3.win32-py2.7.exe, and see it includes both the basic
> mysql module, as well as something called MySQLdb which is some sort
> of a wrapper or something, but anyway.
>  
> Anyway, was just wondering if there are specific ways it would be
> better to connect to a MySQL database/server, and if there are
> commonly used examples out there, since didn't seem to find any off
> hand, and this is starting to come together, but, just wondering..?

MySQLdb is a basic but functional database connector.  It is specific to
MySQL.  Personally, I prefer "oursql" because it is a little more
refined, but both will get the job done  Both will work in either
Windows or Linux.  The ADODB API is a more general; it uses a database
driver that gets installed in the operating system, so the API is the
same for any database server it supports, and it supports a lot of
them.  However, it is Windows only (as far as I know).

Virtually all Python database APIs have the same basic model.  You call
a single "connect" function to get a database object.  You ask that
object for a "cursor".  You call the cursor's "execute" method to run an
SQL query.  Then you use methods like "fetchone" and "fetchall" to
retrieve the records one by one.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list