[DB-SIG] MySQL Access UPDATE
Brett Chadwick
brett.chadwick at gcserv.com
Wed Aug 10 23:50:33 CEST 2005
All,
This is the current code I am trying to use, it is modeled after some examples I have seen. If someone can provide a better example or way to access the MySQL server and pull or push data to a database on the server that would be appreciated.
##Database name is Test, Table name is Test1, feild is name,Fred, and PKID##
def sqlconnect():
import _mysql
import MySQLdb
db=_mysql.connect(host="10.15.10.201",user="bjchadwick",
passwd="checkthis",db="test")
db.query("""SELECT * FROM Test1 WHERE name""")
print "Connected"
sqlconnect()
def data():
class Table:
def __init__(self, db, test):
self.db = db
self.name = Test1
self.dbc = self.db.cursor()
def __getitem__(self, item):
self.dbc.execute("SELECT * FROM Test1" %
(self.name, item))
return self.dbc.fetchnone()
for i in xrange(80, 100):
print "Data %s: %s" (i, Test1[i])
data()
Thanks,
Ex - 3016
Brett Chadwick
VO Administrator
GC Services
brett.chadwick at gcserv.com
-----Original Message-----
From: db-sig-bounces at python.org [mailto:db-sig-bounces at python.org]On
Behalf Of db-sig-request at python.org
Sent: Wednesday, August 10, 2005 3:00 AM
To: db-sig at python.org
Subject: DB-SIG Digest, Vol 29, Issue 4
Send DB-SIG mailing list submissions to
db-sig at python.org
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/db-sig
or, via email, send a message with subject or body 'help' to
db-sig-request at python.org
You can reach the person managing the list at
db-sig-owner at python.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of DB-SIG digest..."
More information about the DB-SIG
mailing list