- marked as enhancement
- changed milestone to 0.7.6
- changed status to resolved
offer option to skip parameters in execute call ?
Issue #2407
resolved
this because the escaping of % issue is beginning to become unworkable in Alembic. We can't do this feature too easily just yet since it will break code that escapes % signs already. but need to consider if there's a way to do this, since as it is we are not exposing a key feature of the psycopg2 and mysql APIs, that interpretation of % is optional.
diff -r f37aa86df8fa885a5d098930c8a444b96f374f60 lib/sqlalchemy/engine/base.py
--- a/lib/sqlalchemy/engine/base.py Mon Feb 13 19:29:38 2012 -0500
+++ b/lib/sqlalchemy/engine/base.py Mon Feb 13 19:42:18 2012 -0500
@@ -1655,6 +1655,11 @@
statement,
parameters,
context)
+ elif context.skip_parameters:
+ self.dialect.do_execute_no_params(
+ cursor,
+ statement,
+ context)
else:
self.dialect.do_execute(
cursor,
diff -r f37aa86df8fa885a5d098930c8a444b96f374f60 lib/sqlalchemy/engine/default.py
--- a/lib/sqlalchemy/engine/default.py Mon Feb 13 19:29:38 2012 -0500
+++ b/lib/sqlalchemy/engine/default.py Mon Feb 13 19:42:18 2012 -0500
@@ -334,6 +334,9 @@
def do_execute(self, cursor, statement, parameters, context=None):
cursor.execute(statement, parameters)
+ def do_execute_no_params(self, cursor, statement, context=None):
+ cursor.execute(statement)
+
def is_disconnect(self, e, connection, cursor):
return False
@@ -387,6 +390,7 @@
else:
self.parameters = [{}]({})
+ self.skip_parameters = self.execution_options.get("no_params", False)
return self
@classmethod
@@ -478,6 +482,7 @@
param[key](key) = compiled_params[key](key)
parameters.append(param)
self.parameters = dialect.execute_sequence_format(parameters)
+ self.skip_parameters = self.execution_options.get("no_params", False)
return self
@@ -521,6 +526,7 @@
else:
self.statement = self.unicode_statement = statement
+ self.skip_parameters = self.execution_options.get("no_params", False)
self.cursor = self.create_cursor()
return self
@@ -535,6 +541,7 @@
self.engine = connection.engine
self.execution_options = connection._execution_options
self.cursor = self.create_cursor()
+ self.skip_parameters = self.execution_options.get("no_params", False)
return self
@util.memoized_property
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.7.6 (automated comment)
- Log in to comment
just to get alembic working this is in df15546cb8903e0eef0182faa0eda1691bf6bac8