diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2020-03-24 19:53:14 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2020-03-24 19:53:14 +0000 |
| commit | fa1f67a01e80367d73cf5d1d93b6f7f51dc1746b (patch) | |
| tree | 7c0c5e37a7d1708289a68fcdf30df9dad9013088 /lib/sqlalchemy/testing/assertsql.py | |
| parent | e817d1415d825bcf8c8f33927baaf56cd5d07b95 (diff) | |
| parent | cadfc608d63f4e0df46c0daaa28902423fd88d71 (diff) | |
| download | sqlalchemy-fa1f67a01e80367d73cf5d1d93b6f7f51dc1746b.tar.gz | |
Merge "Convert schema_translate to a post compile"
Diffstat (limited to 'lib/sqlalchemy/testing/assertsql.py')
| -rw-r--r-- | lib/sqlalchemy/testing/assertsql.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/sqlalchemy/testing/assertsql.py b/lib/sqlalchemy/testing/assertsql.py index e38c7ddd8..f0da69400 100644 --- a/lib/sqlalchemy/testing/assertsql.py +++ b/lib/sqlalchemy/testing/assertsql.py @@ -91,21 +91,23 @@ class CompiledSQL(SQLMatchRule): context = execute_observed.context compare_dialect = self._compile_dialect(execute_observed) + + if "schema_translate_map" in context.execution_options: + map_ = context.execution_options["schema_translate_map"] + else: + map_ = None + if isinstance(context.compiled.statement, _DDLCompiles): + compiled = context.compiled.statement.compile( - dialect=compare_dialect, - schema_translate_map=context.execution_options.get( - "schema_translate_map" - ), + dialect=compare_dialect, schema_translate_map=map_ ) else: compiled = context.compiled.statement.compile( dialect=compare_dialect, column_keys=context.compiled.column_keys, inline=context.compiled.inline, - schema_translate_map=context.execution_options.get( - "schema_translate_map" - ), + schema_translate_map=map_, ) _received_statement = re.sub(r"[\n\t]", "", util.text_type(compiled)) parameters = execute_observed.parameters |
