From 158c7b2401767a116bfe29fcdc8c208380ededf7 Mon Sep 17 00:00:00 2001 From: Francisco Moreno <50809863+fmorenodesigns@users.noreply.github.com> Date: Wed, 24 Apr 2024 09:44:55 +0200 Subject: [PATCH] Add support for environments running psycopg3 to the migration executor (#19) --- migration_checker/executor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/migration_checker/executor.py b/migration_checker/executor.py index b88ae73..08fded4 100644 --- a/migration_checker/executor.py +++ b/migration_checker/executor.py @@ -33,7 +33,12 @@ def __call__( context: dict[str, Any], ) -> Any: cursor = context["cursor"] - rendered_sql = cursor.mogrify(sql, params).decode() + mogrify_result = cursor.mogrify(sql, params) + rendered_sql: str = ( + mogrify_result + if isinstance(mogrify_result, str) + else mogrify_result.decode() + ) self.queries.append(rendered_sql) return execute(sql, params, many, context)