Skip to content

Commit

Permalink
Merge pull request #7 from apavelchuk/fix-mogrify-psycopg3
Browse files Browse the repository at this point in the history
Fix mogrify() for psycopg3
  • Loading branch information
paul-wolf committed May 3, 2023
2 parents edb17bd + 15a1455 commit 7a76129
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion djaq/query/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ def mogrify(self, sql, parameters):

conn = connections[self.using]
cursor = conn.cursor()
return cursor.mogrify(sql, parameters).decode()
mogrified = cursor.mogrify(sql, parameters)
if isinstance(mogrified, bytes):
return mogrified.decode()
return mogrified

def dump(self):
for k, v in self.__dict__.items():
Expand Down

0 comments on commit 7a76129

Please sign in to comment.