[storm] Python 3
Vernon Cole
vernondcole at gmail.com
Wed Jan 7 15:21:59 GMT 2009
On the Windows side of things, adodbapi should be ready for Python 3
in a few weeks, so a version 3 capable adapter could soon be
available. (Wouldn't it be funny if Windows storm had a feature before
Linux?) The present storm branch which uses adodbapi is targeted at
Microsoft SQL, but that unnaturally limits the interface. adodbapi
can talk to many databases, including MySQL. I have not actually
tested it with PostgreSQL, but it is supposed do that, too.
One of my goals in life has been to get storm talking to MSSQL --
that is why I have taken on the maintenance of adodbapi. But it would
be easier to do a storm<->adodbapi<->MySQL backend than a
storm<->adodbapi<->MSSQL backend, and it would be a reasonable
stepping stone in getting an MSSQL backend running. That way the
actual operation of the api can be debugged separately from the
idiosyncrasies of Microsoft's dialect of SQL.
[Also, it would make multi-database access more installation
friendly. I have a (non-storm) script in production which talks to SQL
server or MySQL or SQLite and AS400 SQL simultaneously. (It accesses a
postal-code database on the PC network and a customer database on the
mainframe.) I can do it with only two imports -- the built-in one for
SQLite and adodbapi for all the rest.]
My question is, which would be better:
1) Create multiple database adapters requiring multiple schemes, so
that I use a different URL depending on whether I am accessing (for
example) MySQL using ado, or MySQL using MySQLdb.
database = create_database("mysql://username:password@hostname:port/database_name")
vs.
database = create_database("adomysql://username:password@hostname:port/database_name")
2) Let the backend itself itself probe for the modules it might be able to use:
try:
import MySQLdb as db
import MySQLdb.converter
except ImportError:
try:
import adodbapi as db
except ImportError:
db = dummy
db.connect('connection_string')
My feeling is that option 2 is the more pythonic way to go.
Would such code be accepted in the trunk?
--
Vernon Cole
On Tue, Jan 6, 2009 at 11:46 PM, James Henstridge <james at jamesh.id.au> wrote:
> On Tue, Jan 6, 2009 at 10:33 PM, Grahame Bowland <grahame at angrygoats.net> wrote:
>> Hi all
>>
>> Just wondering if there is any plan for a Python 3 version of Storm.
>> I'd be interested in helping out with the port if there is one
>> planned.
>
> I am sure there is interest, but I don't think there is any fixed time
> frame yet. We've got some pretty large Python 2 apps to support
> (Launchpad, Landscape, etc) so the 2.x version is likely to be the
> primary focus for a while to come.
>
> A prerequisite for this would be Python 3 compatible database
> adapters. SQLite should be fine here as its bindings are in the
> standard library. Ports of the PostgreSQL and MySQL adapters are not
> yet available though.
>
> James.
>
> --
> storm mailing list
> storm at lists.canonical.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
>
More information about the storm
mailing list