Martin DeMello wrote: > Hi, > > I have got pyodbc set up and successfully connecting to my database, > now I would like to use it from Storm. I looked through the API but > couldn't figure out how I could drop in a pyodbc.Connection object and > have storm work with that. If you look in database.py, you'll see that all you need is a factory function/class for your database. The code needs to a) take a URI and return a Database object b) implement raw_connect() on that Database object
Calling storm.database.register_scheme(scheme, factory) will register your factory for supplied scheme (e.g. 'mysql' for 'mysql://...' URIs, I would guess 'odb' for 'odb://...' URIs). Alternatively, you can write your code in a module, stick it in storm.databases as storm.databases.odb, and implement the module-level function create_from_uri (or remap the class to that function name as well). > Has anyone done this? Any pointers? > > martin > Either of the two options above will _work_ for connections, but if there are any database-specific quirks there could still be issues. See storm.databases.mysql for some examples. There is an alternative Connection object (using Database.connection_factory), and alternative Result object (using Connection.result_factory), and some alternative compile functions (using Connection.compile and tagged with @compile.when(...)). Try a Database object and run the tests - I hope it works! - Jeremy -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
