source: orange/Orange/doc/modules/ @ 9671:a7b056375472

Revision 9671:a7b056375472, 714 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

1# Description: Writes a data set to and reads from an SQL database
2# Category:    file formats
3# Classes:     ExampleTable, orngSQL.SQLReader, orngSQL.SQLWriter
4# Uses:
5# Referenced:  orngSQL.htm
7import orange, orngSQL, orngTree
9data = orange.ExampleTable("iris")
10print "Input data domain:"
11for a in data.domain.variables:
12    print a
13w = orngSQL.SQLWriter('mysql://user:somepass@localhost/test')
14w.create('iris', data)
16r = orngSQL.SQLReader('mysql://user:somepass@puhek/test')
17r.execute('SELECT "petal width", "petal length" FROM iris WHERE "sepal length"<5.0')
18data =
19print "\n%d instances returned" % len(data)
20print "Output data domain:"
21for a in data.domain.variables:
22    print a
Note: See TracBrowser for help on using the repository browser.