[Tutor] Problem with PostgreSQL module

Kent Johnson kent_johnson at skillsoft.com
Sun Aug 15 02:07:45 CEST 2004


Shufen,

pgdb uses the Python DB-API. This is a standardized API for database 
interface from Python. If you use DB-API your program will fairly portable 
between databases. (There are still some differences, for example SQL 
dialects, but DB-API helps.) DB-API supports cursors so the examples you 
are looking at are probably using this module. DB-API is documented here: 
http://www.python.org/peps/pep-0249.html

pg was written before DB-API was standardized so it is specific to PostgreSQL.

You should be able to tell which module the tutorials and books are using 
by looking at the import statements in their sample programs.

HTH,
Kent

At 08:16 AM 8/15/2004 +1000, Ms Soo Chong wrote:
>Hi all,
>
>I resend this message too, just in case the previous one was overlooked.
>
>I really hope to hear from you guys soon.
>
>Sorry I'm still new to python so if you happened to see a stupid question 
>asked from
>me, just bear with it. ;p
>
>I have questions on PostgreSQL module.
>
>Referred to the help given by python tutor, I managed to import pg and did 
>some
>queries on the interactive window. However, I don't quite understand the 
>differences
>between old module "pg" and the newer module "pgDB"
>(http://www.pygresql.org/README.txt). Besides, I read through some 
>tutorials and book,
>they all used cursor objects, can I use cursor objects too or I have to 
>use other
>commands? FYI, I'm using the older module "pg" now. If I have to use other 
>command,
>please kindly state them down too.
>
>THANK YOU IN ADVANCE...
>
>OS: Linux
>
>Looking forward to hear from you.
>
>Cheers,
>Shufen
>
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list