Changeset: 2c9df8c8592b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c9df8c8592b Modified Files: .hgignore python/MANIFEST python/README.rst python/README.txt Branch: Oct2010 Log Message:
Renamed python/README.rst to README.txt and added MANIFEST. This should help building a source distribution and RPMs using setup.py. diffs (273 lines): diff -r fd8da76b3616 -r 2c9df8c8592b .hgignore --- a/.hgignore Tue Sep 07 11:03:13 2010 +0200 +++ b/.hgignore Tue Sep 07 13:27:06 2010 +0200 @@ -57,6 +57,7 @@ ^pathfinder/NT/runtime/ ^pathfinder/conf/compile$ ^python/build/ +^python/dist/ ^sql/NT/MonetDB-SQL\.pc$ aclocal\.m4$ acout\.in$ diff -r fd8da76b3616 -r 2c9df8c8592b python/MANIFEST --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/MANIFEST Tue Sep 07 13:27:06 2010 +0200 @@ -0,0 +1,27 @@ +COPYRIGHT +README.txt +debian/changelog +debian/compat +debian/control +debian/copyright +debian/docs +debian/pycompat +debian/rules +examples/basics.py +examples/perf.py +monetdb/__init__.py +monetdb/mapi.py +monetdb/mapi2.py +monetdb/mapi3.py +monetdb/mclient.py +monetdb/monetdb_exceptions.py +monetdb/sql/__init__.py +monetdb/sql/connections.py +monetdb/sql/converters.py +monetdb/sql/cursors.py +monetdb/sql/type_codes.py +setup.py +test/capabilities.py +test/dbapi20.py +test/run.sh +test/runtests.py diff -r fd8da76b3616 -r 2c9df8c8592b python/README.rst --- a/python/README.rst Tue Sep 07 11:03:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -========================================== -The MonetDB MAPI and SQL client python API -========================================== - - -Introduction -============ -This is the new native python client API. This API is cross-platform, and -doesn't depend on any monetdb libraries. It has support for python 2.5, 2.6 and -3.0 and is Python DBAPI 2.0 compatible. - - -Changes -======= - -A number of things are different compared to the old version that uses the mapi -library: - -* No dependecies on MonetDB libraries anymore -* MAPI protocol is now implemented in pure python -* Added unit tests for the SQL API -* The MAPI module is now named monetdb.mapi -* The SQL module is now named monetdb.sql -* Small changes in argument names for functions -* Type conversion is working (for example a monetdb int becomes a python int) -* Dropped support for the dictionary based cursor - - -Installation -============ - -To install the MonetDB python API run the following command from the python -source directory:: - - # python setup.py install - -That's all, now you are ready to start using the API. - - -Documentation -============= - -The python code is well documented, so if you need to find documentation you -should have a look at the source code. Below is an interactive example on how -to use the monetdb SQL API which should get you started quite fast. - - -Examples -======== - -There are some examples in the 'examples' folder, but here are is a line by -line example of the SQL API:: - - > # import the SQL module - > import monetdb.sql - > - > # set up a connection. arguments below are the defaults - > connection = monetdb.sql.connect(username="monetdb", password="monetdb", hostname="localhost", database="demo") - > - > # create a cursor - > cursor = connection.cursor() - > - > # increase the rows fetched to increase performance (optional) - > cursor.arraysize = 100 - > - > # execute a query (return the number of rows to fetch) - > cursor.execute('SELECT * FROM tables') - 26 - > - > # fetch only one row - > cursor.fetchone() - [1062, 'schemas', 1061, None, 0, True, 0, 0] - > - > # fetch the remaining rows - > cursor.fetchall() - [[1067, 'types', 1061, None, 0, True, 0, 0], - [1076, 'functions', 1061, None, 0, True, 0, 0], - [1085, 'args', 1061, None, 0, True, 0, 0], - [1093, 'sequences', 1061, None, 0, True, 0, 0], - [1103, 'dependencies', 1061, None, 0, True, 0, 0], - [1107, 'connections', 1061, None, 0, True, 0, 0], - [1116, '_tables', 1061, None, 0, True, 0, 0], - ... - [4141, 'user_role', 1061, None, 0, True, 0, 0], - [4144, 'auths', 1061, None, 0, True, 0, 0], - [4148, 'privileges', 1061, None, 0, True, 0, 0]] - > - > # Show the table meta data - > cursor.description - [('id', 'int', 4, 4, None, None, None), - ('name', 'varchar', 12, 12, None, None, None), - ('schema_id', 'int', 4, 4, None, None, None), - ('query', 'varchar', 168, 168, None, None, None), - ('type', 'smallint', 1, 1, None, None, None), - ('system', 'boolean', 5, 5, None, None, None), - ('commit_action', 'smallint', 1, 1, None, None, None), - ('temporary', 'tinyint', 1, 1, None, None, None)] - - -If you would like to communicate with the database at a lower level you can use -the MAPI library:: - - > from monetdb import mapi - > server = mapi.Server() - > server.connect(hostname="localhost", port=50000, username="monetdb", password="monetdb", database="demo", language="sql") - > server.cmd("sSELECT * FROM tables;") - ... - diff -r fd8da76b3616 -r 2c9df8c8592b python/README.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/README.txt Tue Sep 07 13:27:06 2010 +0200 @@ -0,0 +1,115 @@ +.. This document is written in reStructuredText (see + http://docutils.sourceforge.net/ for more information). + Use ``rst2html.py`` to convert this file to HTML. + +========================================== +The MonetDB MAPI and SQL client python API +========================================== + + +Introduction +============ + +This is the new native python client API. This API is cross-platform, +and doesn't depend on any monetdb libraries. It has support for +python 2.5, 2.6 and 3.0 and is Python DBAPI 2.0 compatible. + + +Changes +======= + +A number of things are different compared to the old version that uses +the mapi library: + +* No dependecies on MonetDB libraries anymore +* MAPI protocol is now implemented in pure python +* Added unit tests for the SQL API +* The MAPI module is now named monetdb.mapi +* The SQL module is now named monetdb.sql +* Small changes in argument names for functions +* Type conversion is working (for example a monetdb int becomes a + python int) +* Dropped support for the dictionary based cursor + + +Installation +============ + +To install the MonetDB python API run the following command from the +python source directory:: + + # python setup.py install + +That's all, now you are ready to start using the API. + + +Documentation +============= + +The python code is well documented, so if you need to find +documentation you should have a look at the source code. Below is an +interactive example on how to use the monetdb SQL API which should get +you started quite fast. + + +Examples +======== + +There are some examples in the 'examples' folder, but here are is a +line by line example of the SQL API:: + + > # import the SQL module + > import monetdb.sql + > + > # set up a connection. arguments below are the defaults + > connection = monetdb.sql.connect(username="monetdb", password="monetdb", hostname="localhost", database="demo") + > + > # create a cursor + > cursor = connection.cursor() + > + > # increase the rows fetched to increase performance (optional) + > cursor.arraysize = 100 + > + > # execute a query (return the number of rows to fetch) + > cursor.execute('SELECT * FROM tables') + 26 + > + > # fetch only one row + > cursor.fetchone() + [1062, 'schemas', 1061, None, 0, True, 0, 0] + > + > # fetch the remaining rows + > cursor.fetchall() + [[1067, 'types', 1061, None, 0, True, 0, 0], + [1076, 'functions', 1061, None, 0, True, 0, 0], + [1085, 'args', 1061, None, 0, True, 0, 0], + [1093, 'sequences', 1061, None, 0, True, 0, 0], + [1103, 'dependencies', 1061, None, 0, True, 0, 0], + [1107, 'connections', 1061, None, 0, True, 0, 0], + [1116, '_tables', 1061, None, 0, True, 0, 0], + ... + [4141, 'user_role', 1061, None, 0, True, 0, 0], + [4144, 'auths', 1061, None, 0, True, 0, 0], + [4148, 'privileges', 1061, None, 0, True, 0, 0]] + > + > # Show the table meta data + > cursor.description + [('id', 'int', 4, 4, None, None, None), + ('name', 'varchar', 12, 12, None, None, None), + ('schema_id', 'int', 4, 4, None, None, None), + ('query', 'varchar', 168, 168, None, None, None), + ('type', 'smallint', 1, 1, None, None, None), + ('system', 'boolean', 5, 5, None, None, None), + ('commit_action', 'smallint', 1, 1, None, None, None), + ('temporary', 'tinyint', 1, 1, None, None, None)] + + +If you would like to communicate with the database at a lower level +you can use the MAPI library:: + + > from monetdb import mapi + > server = mapi.Server() + > server.connect(hostname="localhost", port=50000, username="monetdb", password="monetdb", database="demo", language="sql") + > server.cmd("sSELECT * FROM tables;") + ... + _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list