[PD] MySql database accessing with PureData ?
Thomas Grill
t.grill at gmx.net
Wed Dec 17 16:25:11 CET 2003
> Hello Thomas,
> Unfortunately i don't know anything about python excepted that i should
> learn it !
> Could you give me an estimation of the time needed by a newbie to script
> a MySql reader for pd ?
MySQL-Python modules can be found here:
http://www.mysql.com/downloads/api-python.html
and examples are given in
http://www.devshed.com/Server_Side/Python/PythonMySQL/print_html
e.g.
-----------------------
#!/usr/bin/python
# import MySQL module
import MySQLdb
# connect
db = MySQLdb.connect(host="localhost", user="joe",
passwd="secret",db="db56a")
# create a cursor
cursor = db.cursor()
# execute SQL statement
cursor.execute("SELECT * FROM animals")
# get the resultset as a tuple
result = cursor.fetchall()
# iterate through resultset
for record in result:
print record[0] , "-->", record[1]
------------------------
For simplicity you should probably start with py (instead of pyext) - have a
look at the examples.
best greetings,
Thomas
More information about the Pd-list
mailing list