From: Inada Naoki Date: Sat, 10 Jun 2023 18:34:07 +0000 (+0900) Subject: doc: Update connection example (#9926) X-Git-Tag: rel_2_0_16~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d565d0d2226312d37e7922d33df6e0cd107f996b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git doc: Update connection example (#9926) Row object is now namedtuple-like. --- diff --git a/doc/build/core/connections.rst b/doc/build/core/connections.rst index f2d0f4f5ae..dc71fab28e 100644 --- a/doc/build/core/connections.rst +++ b/doc/build/core/connections.rst @@ -48,7 +48,7 @@ a textual statement to the database looks like:: with engine.connect() as connection: result = connection.execute(text("select username from users")) for row in result: - print("username:", row["username"]) + print("username:", row.username) Above, the :meth:`_engine.Engine.connect` method returns a :class:`_engine.Connection` object, and by using it in a Python context manager (e.g. the ``with:``