[Biopython-dev] zxJDBC support for BioSQL

Kyle Ellrott kellrott at gmail.com
Wed Jan 13 17:37:53 UTC 2010


My main thought was to make it so that users can write a single script that
would work on any Python system (eventually IronPython as well).  Because
the current system expects the user to request a specific driver (MySQLdb)
that happens to be system specific, it forces user code to be system
specific.
One alternative would be to use the strings you describe below, but in
addition add special requests that would check the system add pull the
appropriate driver automatically.
'autoMySQL' or 'MySQL' - uses MySQLdb if in CPython, use
org.gjt.mm.mysql.Driver if in Jython.
Otherwise, if the user wants to use a specific driver, they pass it's name.

Kyle

On Wed, Jan 13, 2010 at 3:22 AM, Peter <biopython at maubp.freeserve.co.uk>wrote:

> On Tue, Jan 12, 2010 at 10:06 PM, Kyle Ellrott <kellrott at gmail.com> wrote:
> > I haven't played with Postgre yet (don't even have it installed).
> > Sqlite as a python package hasn't been standardized to Jython yet  (
> > http://bugs.jython.org/issue1682864 )
> >
> > One option is to call SQLite JDBC (
> > http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC ) rather then reusing
> the
> > existing SQLite code.
> > But like zxJDBC, the jar would need to be in the CLASSPATH variable for
> the
> > code to work.
>
> I'm not 100% convinced that the details of your current approach
> are the best way forward: Specifically taking a user script that works
> on (C) Python using MySQL with MySQLdb as the driver, and when
> run on Jython automatically interpreting this to use the Java MySQL
> Connector/J with the org.gjt.mm.mysql.Driver (and so on for the
> PostgreSQL and SQLite drivers?)
>
> It might be clearer if we just treat the different Jython/Java drivers
> as top level alternatives:
>
> * MySQLdb (Python only, at least for now)
> * psycopg, psycopg2, pgdb (Python only, at least for now)
> * sqlite3 (currently Python only, maybe available on Jython later)
> * org.gjt.mm.mysql.Driver (Jython only)
> * Some JAVA PostreSQL driver (Jython only)
> * Some JAVA SQLite driver (Jython only)
>
> This way we have a clean separation of all the different driver
> or database specific changes - although the user is required
> to make some minor changes to take an existing BioSQL on
> MySQL script to explicitly change the driver from MySQLdb
> to org.gjt.mm.mysql.Driver if they want to run it on Jython.
> We also won't have lots of "if jython" statements everywhere.
>
> What are your thoughts on this?
>
> Note there will be some similarities between all the MySQL
> adaptors, all the PostgreSQL adaptors, etc. I've just made
> a small improvement to file BioSQL/DBUtils.py to reduce
> the code duplication for the existing (C) Python PostgreSQL
> adaptors.
>
> Peter
>



More information about the Biopython-dev mailing list