From: Dave S. <Dst...@em...> - 2002-06-13 01:31:31
|
You're gonna think I'm whacko, but actually, I have read those docs. What I'm missing, is what do I load ( I think its "import PgSQL") so that I can use the connect command etc. When I start up Python, it doesn't understand any of the pypgsql commands, and I assume that's b/c I need to load a library... Dave Strickler CEO DWS - "The GroupWise Integration Experts" Boston * Austin * Belgium * Denmark http://www.emailsolutions.com (800) 999-5412 x10 ------------------------------------ Want to get rid of SPAM, Viruses, and unwanted content? MailWise Filter - "The E-Mail Firewall (tm) for Your Company" See http://www.emailsolutions.com/MailWise >>> Gerhard =?iso-8859-15?Q?H=E4ring?= <ge...@bi...> 06/12/02 06:24PM >>> * Dave Strickler < Dst...@em... > [2002-06-12 17:23 -0400]: > Thanks for the tips! > > What I am looking for is even one step above that. When I load up > Python, how do I tell is to import the PgSQL library so that it > understands these commands? Oops. 100.00 % new to Python? There is a python (or python.exe, depending on the OS) interpreter. It can be used interactively for trying out stuff, like this transcript shows: gerhard@lilith:~$ python Python 2.2.1 (#1, Apr 21 2002, 08:38:44) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from pyPgSQL import PgSQL >>> print "hello" hello >>> print 4+5 9 >>> from pyPgSQL import PgSQL >>> conn = PgSQL.connect() >>> cursor = conn.cursor() >>> cursor.execute("select * from test") >>> print cursor.fetchone() [1, 'Gerhard', 25] >>> But you normally don't use Python this way except for experimenting (for this, it's very cool, though.) You normally write Python modules and scripts and put them in files, ending in .py. Several approaches are possible for the actual development cycle. Many people, me included, simple use their favourite editor to write the Python source files, than run them on the commandline. There are also IDEs available, one is even included in the Python standard distribution: IDLE. > Thanks for your help... The Python documentation, that you'll likely already have installed, includes a tutorial, which is ok if you already know programming. It's also available online: http://www.python.org/doc/current/tut/tut.html The following page lots of useful information for Python beginners and beginners to programmin in general: http://www.python.org/doc/Newbies.html I'd recommend to get familiar with Python itself first, then, after a few days install pyPgSQL and try database programming. All of the above isn't to be taken as absolute of course, it all depends on your previous experience. I believe the resources from these URLs will get you started relatively quickly. Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930 public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) |