From: Daniele Varrazzo Date: Fri, 7 Jan 2022 01:54:25 +0000 (+0100) Subject: Add example about DDL statement with quoted parameter X-Git-Tag: pool-3.1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07df0295712755145d2dd83df2f76065fc87d5bd;p=thirdparty%2Fpsycopg.git Add example about DDL statement with quoted parameter See #199. --- diff --git a/docs/basic/from_pg2.rst b/docs/basic/from_pg2.rst index 383cfb1a4..7f2986da7 100644 --- a/docs/basic/from_pg2.rst +++ b/docs/basic/from_pg2.rst @@ -69,8 +69,12 @@ If this is not possible, you can use client-side binding using the objects from the `sql` module:: >>> from psycopg import sql + >>> conn.execute(sql.SQL("CREATE TABLE foo (id int DEFAULT {})").format(42)) + # This will correctly quote the password + >>> conn.execute(sql.SQL("ALTER USER john SET PASSWORD {}").format(password)) + .. _multi-statements: