On Jul 11, 8:49 pm, Domen Kožar <
iElect...@gmail.com> wrote:
> Maybe we should just put try/finally in inner code of those api
> functions that construct engine. It wouldn't be hard to maintain.
well if you're going to repeat something many times, at least it
shouldn't be an implementation that's repeated. Here's another
method:
def db_version(url, repository, **opts):
schema = with_engine(url, opts,
ControlledSchema,
repository
)
return schema.version
where with_engine is:
def with_engine(url, opts, fn, *args, **kw):
engine = create_engine(url, **opts)
try:
return fn(engine, *args, **kw)
finally:
engine.dispose()
since I'm assuming the "hackish" part is the decorator generated from
a string. Take a look at the source to decorator.py, they're doing
the same thing.
> Also note that
> latest tip provides option to pass in already constructed engine and
> users may not want it to be cleared.
thats a good feature, and you should make sure it can take in a
connection as well as an engine, so I can do many operations within a
single transaction (PG has CREATE/ALTER statements participate in
transactions).
I've put up a new patch on the tracker that finishes off firebird
support and adds support for a name change of "postgresql" in 0.6.
Oracle tests also pass 100% with 0.6 + migrate.