From ba71c05860c347cf9918ea672580ba74e50a22ca Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 3 Apr 2014 02:46:13 +0100 Subject: [PATCH] Clarify in the docs that mogrify() and query always return bytes --- doc/src/cursor.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/src/cursor.rst b/doc/src/cursor.rst index 3e3d8a0a..ebfa90ad 100644 --- a/doc/src/cursor.rst +++ b/doc/src/cursor.rst @@ -215,6 +215,8 @@ The ``cursor`` class exactly the one that would be sent to the database running the `~cursor.execute()` method or similar. + The returned string is always a bytes string. + >>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar')) "INSERT INTO test (num, data) VALUES (42, E'bar')" @@ -427,11 +429,11 @@ The ``cursor`` class .. attribute:: query Read-only attribute containing the body of the last query sent to the - backend (including bound arguments). `!None` if no query has been - executed yet: + backend (including bound arguments) as bytes string. `!None` if no + query has been executed yet: >>> cur.execute("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 'bar')) - >>> cur.query + >>> cur.query "INSERT INTO test (num, data) VALUES (42, E'bar')" .. extension::