[Tutor] Python and SQL
Joachim Thöne
JoachimThoene@web.de
Wed, 27 Jun 2001 22:38:19 -0400
Deirdre Saoirse Moen schrieb:
>
> At 9:21 PM -0400 6/27/01, Joachim Thöne wrote:
> >Hello all,
> >I'm new to this list and not very expierienced with Python. For I want
> >to write an application that uses Python and the Postgresql database I
> >need Information how to use the Python API for Postgres (Example: how =
to
> >call Databasecommands like 'SELECT * FROM Database', or how to log in =
to
> >a Database from a Python Script).
> >Does anybody know a tutorial and where I can find somethin about that?
>
> You want to look at the database sig stuff:
>
> http://www.python.org/topics/database/
>
> And also:
>
> http://www.druid.net/pygresql/
>
> http://www.amk.ca/python/writing/DB-API.html (it's mostly the same
> for postgres, but a little different)
>
> >Thanks and sorry for my bad English, its not my native language.
>
> Quite alright, it's better than my German. :)
>
> Basically, the process is something like:
>
> 1) Open the database
> 2) Create a cursor
> 3) Execute a statement with that cursor
> 4) Fetch one or more result rows
>
> A mini example can be found here:
>
> http://mail.python.org/pipermail/db-sig/2001-June/001783.html
> http://mail.python.org/pipermail/db-sig/2001-June/001786.html
> --
> _Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
> "Cannot run out of time.... Is infinite time. You... are finite....
> Zathrus... is finite. This... is wrong tool!" -- Zathrus
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
By trying what I've just learned ( Thanks Deidre), Idle displayed the
following error message:
>>> import pgdb
Traceback (most recent call last):
File "<pyshell#0>", line 1, in ?
import pgdb
File "/usr/lib/python2.1/site-packages/pgdb.py", line 65, in ?
except ImportError: import DateTime
ImportError: No module named DateTime
>>>
As a Python newbie of course I don't know a Module named 'DataTime'. So
here is my question:
Where can I find that module?
Thanks
Joachim