From d565d0d2226312d37e7922d33df6e0cd107f996b Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Sun, 11 Jun 2023 03:34:07 +0900 Subject: [PATCH] doc: Update connection example (#9926) Row object is now namedtuple-like. --- doc/build/core/connections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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:`` -- 2.39.5