Browse files

fix bug with parameters in sqla mysql/pgsql

  • Loading branch information...
1 parent 1161320 commit 009a182bc797c3a6f53a25e458df123fa93a321e @piranha committed Sep 21, 2012
Showing with 9 additions and 3 deletions.
  1. +8 −2 nomad/engine/sqla.py
  2. +1 −1 setup.py
View
10 nomad/engine/sqla.py
@@ -7,9 +7,15 @@ class SAEngine(BaseEngine):
def connect(self):
return create_engine(self.url)
- def query(self, *args, **kwargs):
+ def prepare(self, statement):
+ if self.connection.name in ('mysql', 'pgsql'):
+ return statement.replace('?', '%s')
+ return statement
+
+ def query(self, statement, *args, **kwargs):
+ statement = self.prepare(statement)
try:
- return self.connection.execute(*args, **kwargs)
+ return self.connection.execute(statement, *args, **kwargs)
except exc.SQLAlchemyError, e:
raise DBError(str(e))
View
2 setup.py
@@ -11,7 +11,7 @@ def read(fname):
description = 'simple sql migration tool to save you from becoming mad',
long_description = read('README.rst'),
license = 'BSD',
- version = '0.1.2',
+ version = '0.1.3',
author = 'Alexander Solovyov',
author_email = 'alexander@solovyov.net',
url = 'http://github.com/piranha/nomad/',

0 comments on commit 009a182

Please sign in to comment.