By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,081 Members | 861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,081 IT Pros & Developers. It's quick & easy.

why does php have a standard SQL module and Python doesn't !?

P: n/a
Hi,
I thought I would quickly write a
"SELECT * FROM ... " line in python ...
.... but then I was suprised to find that the only "official" web page I
found was mainly linking to the PEP on HOW the DB API2.0 should look
like.
Then there is a choice of maybe ten modules which more or less all
claim to implement 99% of that PEP.

What is the best (easiest ! quickest !) way to get started doing some
SQL in Python ?
(I have mySQL running on a Linux box in our Lab and would like to
access it from Windows (or MacOSX) on some other machine also in the
same subnet)

Sebastian Haase
UCSF

Dec 15 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
se*******@gmail.com wrote:
What is the best (easiest ! quickest !) way to get started doing some
SQL in Python ?
SQL isn't SQL, and there is no "standard" SQL module, not even in PHP (which
ships with modules for MySQL, PostgreSQL and MSSQL/Sybase IIRC). It all
depends on the database backend. See below.
(I have mySQL running on a Linux box in our Lab and would like to
access it from Windows (or MacOSX) on some other machine also in the
same subnet)


For MySQL, try MySQLdb, which is a Python module to allow access to the
MySQL database (what you seem to want to do). Just Google for it. MySQLdb
is DB-API 2.0 compatible.

--- Heiko.
Dec 15 '05 #2

P: n/a
To build on Heiko's comment's, and to be clear, Python does have a
standard interface description, to which many SQL interfaces are
available.

Dec 15 '05 #3

P: n/a
This was my point though: I found the *description* - but no wordon
WHICH implementation to get WHERE ?
Don't get me wrong - I like Python and I will stick to it for some time
to come ...
but WHY are the places to get those SQL implementations not better
marked:
Just try to google for "python sql" and you get here:
http://sourceforge.net/projects/pysqldb/
(then this like to home page (http://pysqldb.sourceforge.net/) is
COMPLETELY EMPTY !!!!)
the next number of hits seem to be completely random.

Even if you google for: python mysql
you get to http://sourceforge.net/projects/mysql-python where
the linked "home page" says:
** OBSOLETE Python Interface to MySQL **

Please try to understand what I'm saying here:
This is essentially a proof the there is no (one) good place to go for
SQL & Python.
Instead it looked really scary to me!
How could I have known that "MySQLdb" is the keyword to google for !?

It would be nice, if those projects would reference back to
"http://www.python.org/topics/database/modules.html" just to give some
assurance that one is not totally off ...

Thanks,
Sebastian

Dec 16 '05 #4

P: n/a
se*******@gmail.com wrote:
This was my point though: I found the *description* - but no wordon
WHICH implementation to get WHERE ?


Hmm.
- Browse to http://www.python.org
- click Documentation
- click Database API
- click Database Modules (Database modules that implement the DB-API specification.)
- read list, find the database of your choice

Kent
Dec 16 '05 #5

P: n/a
OK,
point taken - maybe what threw me off was the simple fact that there
CAN be NO "ONE standard/default SQL package".
As a newbie in sql I was hoping to find something like e.g. the socket
module (one size fits all)

So: Maybe this could be explained on the "Database Modules" page.
(and again: just being on sourceforge doesn't mean a project is still
being developped - for all one call tell from the first look, they
could be abandoned - hint: have a better homepage !!)

Thanks,
Sebastian

Dec 16 '05 #6

P: n/a
se*******@gmail.com wrote:
OK,
point taken - maybe what threw me off was the simple fact that there
CAN be NO "ONE standard/default SQL package".
As a newbie in sql I was hoping to find something like e.g. the socket
module (one size fits all)

So: Maybe this could be explained on the "Database Modules" page.
If you can suggest some text, email it to the webmaster using the address on that page.
(and again: just being on sourceforge doesn't mean a project is still
being developped - for all one call tell from the first look, they
could be abandoned - hint: have a better homepage !!)
This hint needs to go to the MySQL for Python folks, it's their home page.

Kent

Thanks,
Sebastian

Dec 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.