diff options
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/engine/default.py | 10 | ||||
| -rw-r--r-- | lib/sqlalchemy/engine/result.py | 2 | ||||
| -rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 9 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/plugin/noseplugin.py | 22 |
4 files changed, 33 insertions, 10 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 21e02fcdc..f43c0404e 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -625,6 +625,16 @@ class DefaultExecutionContext(interfaces.ExecutionContext): def post_exec(self): pass + def get_result_processor(self, type_, colname, coltype): + """Return a 'result processor' for a given type as present in + cursor.description. + + This has a default implementation that dialects can override + for context-sensitive result type handling. + + """ + return type_._cached_result_processor(self.dialect, coltype) + def get_lastrowid(self): """return self.cursor.lastrowid, or equivalent, after an INSERT. diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index bf6410f15..9fb735f46 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -210,7 +210,7 @@ class ResultMetaData(object): name, obj, type_ = \ colname, None, typemap.get(coltype, types.NULLTYPE) - processor = type_._cached_result_processor(dialect, coltype) + processor = context.get_result_processor(type_, colname, coltype) processors.append(processor) rec = (processor, obj, i) diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index d3a4a64a2..cc41e6182 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -1068,6 +1068,7 @@ class SQLCompiler(engine.Compiled): def visit_select(self, select, asfrom=False, parens=True, iswrapper=False, fromhints=None, compound_index=0, + force_result_map=False, positional_names=None, **kwargs): entry = self.stack and self.stack[-1] or {} @@ -1082,9 +1083,11 @@ class SQLCompiler(engine.Compiled): # to outermost if existingfroms: correlate_froms = # correlate_froms.union(existingfroms) - populate_result_map = compound_index == 0 and ( - not entry or \ - entry.get('iswrapper', False) + populate_result_map = force_result_map or ( + compound_index == 0 and ( + not entry or \ + entry.get('iswrapper', False) + ) ) self.stack.append({'from': correlate_froms, diff --git a/lib/sqlalchemy/testing/plugin/noseplugin.py b/lib/sqlalchemy/testing/plugin/noseplugin.py index 0dcd45825..1651886b8 100644 --- a/lib/sqlalchemy/testing/plugin/noseplugin.py +++ b/lib/sqlalchemy/testing/plugin/noseplugin.py @@ -158,13 +158,23 @@ def _prep_testing_database(options, file_config): e = engines.utf8_engine() inspector = inspect(e) - for vname in inspector.get_view_names(): - e.execute(schema._DropView(schema.Table(vname, schema.MetaData()))) + try: + view_names = inspector.get_view_names() + except NotImplementedError: + pass + else: + for vname in view_names: + e.execute(schema._DropView(schema.Table(vname, schema.MetaData()))) - for vname in inspector.get_view_names(schema="test_schema"): - e.execute(schema._DropView( - schema.Table(vname, - schema.MetaData(), schema="test_schema"))) + try: + view_names = inspector.get_view_names(schema="test_schema") + except NotImplementedError: + pass + else: + for vname in view_names: + e.execute(schema._DropView( + schema.Table(vname, + schema.MetaData(), schema="test_schema"))) for tname in reversed(inspector.get_table_names(order_by="foreign_key")): e.execute(schema.DropTable(schema.Table(tname, schema.MetaData()))) |
