source: orange/docs/reference/rst/Orange.data.sql.rst @ 9992:6e9b398a461b

Revision 9992:6e9b398a461b, 1.6 KB checked in by crt.gorup@…, 2 years ago (diff)

Documentation for Orange.data.sql.

Line 
1##################################
2SQL interface (``sql``)
3##################################
4
5The :class:`sql` module provides access to relational databases from Orange.
6It currently supports `MySql <http://www.mysql.com/>`_  through
7`MySQL for Python <http://sourceforge.net/projects/mysql-python/>`_
8and `Postgres <http://www.postgresql.org>`_ through `Psycopg <http://initd.org/psycopg/>`_.
9
10
11:class:`SQLReader` and :class:`SQLWriter` classes require connection string based on
12standard format scheme://[user[:password]@]host[:port]/database[?parameters].
13
14Examples of valid connection strings:
15
16- mysql://user:password@host/database
17- mysql://host/database?debug=1
18- postgres://user@host/database?debug=&cache=
19- postgres:///full/path/to/socket/database
20- postgres://host:5432/database
21
22**Attribute Names and Types**
23
24Rows returned by an SQL query have to be converted into Orange Instances.
25Each column in a row has to be converted into a certain feature type. The
26following conversions between SQL and Orange types are used:
27
28- STRING and DATETIME attributes are converted to Orange strings.
29- The features listed in ``discrete_names`` are converted to Orange discrete features.
30- Other features are converted to continuous Orange features.
31- The attribute in ``class_name`` is set as the class features. If no ``class_name`` is set, the column with the
32  name "class" in the returned SQL query is set as the class attribute. If no such column exists, the last
33  column is set as the class features.
34
35.. autoclass:: Orange.data.sql.SQLReader
36   :members:
37
38.. autoclass:: Orange.data.sql.SQLWriter
39   :members:
Note: See TracBrowser for help on using the repository browser.