easy_install the package should really work now

master
baztian 2011-01-25 15:33:10 +01:00
parent 916367c32e
commit 0ff0ca7fa9
5 changed files with 179 additions and 161 deletions

2
MANIFEST.in 100644
View File

@ -0,0 +1,2 @@
recursive-include src/test *.py *.sql
include README* COPYING* ez_setup.py

View File

@ -116,6 +116,10 @@ distribution for details.
Changelog Changelog
========= =========
- 0.1.2
- ``easy_install JayDeBeApi`` should really work
- 0.1.1 - 0.1.1
- Fixed bug #688290 "NULL values with converters error on fetch." - Fixed bug #688290 "NULL values with converters error on fetch."

View File

@ -24,7 +24,7 @@ print find_packages('src')
setup( setup(
#basic package data #basic package data
name = 'JayDeBeApi', name = 'JayDeBeApi',
version = '0.1.1', version = '0.1.2',
author = 'Bastian Bowe', author = 'Bastian Bowe',
author_email = 'bastian.bowe@gmail.com', author_email = 'bastian.bowe@gmail.com',
license = 'GNU LGPL', license = 'GNU LGPL',

View File

@ -1,159 +1,163 @@
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: JayDeBeApi Name: JayDeBeApi
Version: 0.1.1 Version: 0.1.2
Summary: A bridge from JDBC database drivers to Python DB-API. Summary: A bridge from JDBC database drivers to Python DB-API.
Home-page: https://launchpad.net/jaydebeapi Home-page: https://launchpad.net/jaydebeapi
Author: Bastian Bowe Author: Bastian Bowe
Author-email: bastian.bowe@gmail.com Author-email: bastian.bowe@gmail.com
License: GNU LGPL License: GNU LGPL
Description: ===================================================================== Description: =====================================================================
JayDeBeApi - bridge from JDBC database drivers to Python DB-API JayDeBeApi - bridge from JDBC database drivers to Python DB-API
===================================================================== =====================================================================
The JayDeBeApi module allows you to connect from Python code to The JayDeBeApi module allows you to connect from Python code to
databases using Java `JDBC databases using Java `JDBC
<http://java.sun.com/products/jdbc/overview.html>`_. It provides a <http://java.sun.com/products/jdbc/overview.html>`_. It provides a
Python DB-API_ v2.0 to that database. Python DB-API_ v2.0 to that database.
It works on ordinary Python (cPython) using the JPype_ Java It works on ordinary Python (cPython) using the JPype_ Java
integration or on `Jython <http://www.jython.org/>`_ to make use of integration or on `Jython <http://www.jython.org/>`_ to make use of
the Java JDBC driver. the Java JDBC driver.
It has been tested with `Hypersonic SQL (HSQLDB) It has been tested with `Hypersonic SQL (HSQLDB)
<http://hsqldb.org/>`_ and `IBM DB2 <http://hsqldb.org/>`_ and `IBM DB2
<http://www.ibm.com/software/data/db2/>`_ for z/OS. <http://www.ibm.com/software/data/db2/>`_ for z/OS.
In contrast to zxJDBC from the Jython project JayDeBeApi let's you In contrast to zxJDBC from the Jython project JayDeBeApi let's you
access a database with Jython AND Python with only minor code access a database with Jython AND Python with only minor code
modifications. JayDeBeApi's future goal is to provide a unique and modifications. JayDeBeApi's future goal is to provide a unique and
fast interface to different types of JDBC-Drivers through a flexible fast interface to different types of JDBC-Drivers through a flexible
plug-in mechanism. plug-in mechanism.
.. contents:: .. contents::
Install Install
======= =======
You can get and install JayDeBeApi with `easy_install You can get and install JayDeBeApi with `easy_install
<http://peak.telecommunity.com/DevCenter/EasyInstall>`_ :: <http://peak.telecommunity.com/DevCenter/EasyInstall>`_ ::
$ easy_install JayDeBeApi $ easy_install JayDeBeApi
If you want to install JayDeBeApi in Jython make sure to have If you want to install JayDeBeApi in Jython make sure to have
EasyInstall available for it. EasyInstall available for it.
Or you can get a copy of the source branch using `bzr Or you can get a copy of the source branch using `bzr
<http://bazaar.canonical.com/>`_ by running :: <http://bazaar.canonical.com/>`_ by running ::
$ bzr branch lp:jaydebeapi $ bzr branch lp:jaydebeapi
and install it with :: and install it with ::
$ python setup.py install $ python setup.py install
or if you are using Jython use :: or if you are using Jython use ::
$ jython setup.py install $ jython setup.py install
It has been tested with Jython 2.5.2. It has been tested with Jython 2.5.2.
If you are using cPython ensure that you have installed JPype_ If you are using cPython ensure that you have installed JPype_
properly. It has been tested with JPype 0.5.4. properly. It has been tested with JPype 0.5.4.
Usage Usage
===== =====
Basically you just import the ``jaydebeapi`` Python module and execute Basically you just import the ``jaydebeapi`` Python module and execute
the ``connect`` method. This gives you a DB-API_ conform connection to the ``connect`` method. This gives you a DB-API_ conform connection to
the database. the database.
The first argument to ``connect`` is the name of the Java driver The first argument to ``connect`` is the name of the Java driver
class. The rest of the arguments are internally passed to the Java class. The rest of the arguments are internally passed to the Java
``DriverManager.getConnection`` method. See the Javadoc of ``DriverManager.getConnection`` method. See the Javadoc of
``DriverManager`` class for details. ``DriverManager`` class for details.
Here is an example: Here is an example:
>>> import jaydebeapi >>> import jaydebeapi
>>> conn = jaydebeapi.connect('org.hsqldb.jdbcDriver', >>> conn = jaydebeapi.connect('org.hsqldb.jdbcDriver',
... 'jdbc:hsqldb:mem', 'SA', '') ... 'jdbc:hsqldb:mem', 'SA', '')
>>> curs = conn.cursor() >>> curs = conn.cursor()
>>> curs.execute('create table CUSTOMER' >>> curs.execute('create table CUSTOMER'
... '("CUST_ID" INTEGER not null,' ... '("CUST_ID" INTEGER not null,'
... ' "NAME" VARCHAR not null,' ... ' "NAME" VARCHAR not null,'
... ' primary key ("CUST_ID"))' ... ' primary key ("CUST_ID"))'
... ) ... )
>>> curs.execute("insert into CUSTOMER values (1, 'John')") >>> curs.execute("insert into CUSTOMER values (1, 'John')")
>>> curs.execute("select * from CUSTOMER") >>> curs.execute("select * from CUSTOMER")
>>> curs.fetchall() >>> curs.fetchall()
[(1, u'John')] [(1, u'John')]
You probably have to configure Jython or JPype to actually be able to You probably have to configure Jython or JPype to actually be able to
access the database driver's jar files. If I want to connect to a HSQL access the database driver's jar files. If I want to connect to a HSQL
in memory database on my Ubuntu machine I'm starting Python by running :: in memory database on my Ubuntu machine I'm starting Python by running ::
$ JAVA_HOME=/usr/lib/jvm/java-6-openjdk python $ JAVA_HOME=/usr/lib/jvm/java-6-openjdk python
Now I have to configure JPype Now I have to configure JPype
>>> jar = '/path/to/my/driver/hsqldb.jar' >>> jar = '/path/to/my/driver/hsqldb.jar'
>>> args='-Djava.class.path=%s' % jar >>> args='-Djava.class.path=%s' % jar
>>> jpype.startJVM(jvm_path, args) >>> jpype.startJVM(jvm_path, args)
or in Jython I have to or in Jython I have to
>>> jar = '/path/to/my/driver/hsqldb.jar' >>> jar = '/path/to/my/driver/hsqldb.jar'
>>> import sys >>> import sys
>>> sys.path.append(jar) >>> sys.path.append(jar)
Contributing Contributing
============ ============
Please submit `bugs and patches Please submit `bugs and patches
<https://bugs.launchpad.net/jaydebeapi>`_. All contributors will be <https://bugs.launchpad.net/jaydebeapi>`_. All contributors will be
acknowledged. Thanks! acknowledged. Thanks!
License License
======= =======
JayDeBeApi is released under the GNU Lesser General Public license JayDeBeApi is released under the GNU Lesser General Public license
(LGPL). See the file ``COPYING`` and ``COPYING.LESSER`` in the (LGPL). See the file ``COPYING`` and ``COPYING.LESSER`` in the
distribution for details. distribution for details.
Changelog Changelog
========= =========
- 0.1.1 - 0.1.2
- Fixed bug #688290 "NULL values with converters error on fetch." - ``easy_install JayDeBeApi`` should really work
- Fixed bug #684909 "Selecting ROWIDs errors out on fetch."
- 0.1.1
- 0.1
- Fixed bug #688290 "NULL values with converters error on fetch."
- Initial release - Fixed bug #684909 "Selecting ROWIDs errors out on fetch."
To do - 0.1
=====
- Initial release
- Extract Java calls to seperate Java methods to increase performance.
- Check if https://code.launchpad.net/dbapi-compliance can help making To do
JayDeBeApi more DB-API complient. =====
- Test it on different databases and provide a flexible db specific
pluign mechanism. - Extract Java calls to seperate Java methods to increase performance.
- SQLAlchemy modules (seperate project) - Check if https://code.launchpad.net/dbapi-compliance can help making
JayDeBeApi more DB-API complient.
.. _DB-API: http://www.python.org/dev/peps/pep-0249/ - Test it on different databases and provide a flexible db specific
.. _JPype: http://jpype.sourceforge.net/ pluign mechanism.
- SQLAlchemy modules (seperate project)
Keywords: db api java jdbc bridge connect sql jpype jython
Platform: UNKNOWN .. _DB-API: http://www.python.org/dev/peps/pep-0249/
Classifier: Development Status :: 3 - Alpha .. _JPype: http://jpype.sourceforge.net/
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) Keywords: db api java jdbc bridge connect sql jpype jython
Classifier: Programming Language :: Java Platform: UNKNOWN
Classifier: Programming Language :: Python Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 2 Classifier: Intended Audience :: Developers
Classifier: Topic :: Database Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Classifier: Topic :: Software Development :: Libraries :: Java Libraries Classifier: Programming Language :: Java
Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Java Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules

View File

@ -1,7 +1,15 @@
COPYING
COPYING.LESSER
MANIFEST.in
README.rst
ez_setup.py
setup.py setup.py
src/JayDeBeApi.egg-info/PKG-INFO src/JayDeBeApi.egg-info/PKG-INFO
src/JayDeBeApi.egg-info/SOURCES.txt src/JayDeBeApi.egg-info/SOURCES.txt
src/JayDeBeApi.egg-info/dependency_links.txt src/JayDeBeApi.egg-info/dependency_links.txt
src/JayDeBeApi.egg-info/top_level.txt src/JayDeBeApi.egg-info/top_level.txt
src/jaydebeapi/__init__.py src/jaydebeapi/__init__.py
src/jaydebeapi/dbapi2.py src/jaydebeapi/dbapi2.py
src/test/integration_test.py
src/test/data/create.sql
src/test/data/insert.sql