diff options
| author | Federico Caselli <cfederico87@gmail.com> | 2022-10-01 23:49:55 +0200 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-02 11:51:02 -0400 |
| commit | 04a72ff3a94228dcf17d104616daec0c4b6c251e (patch) | |
| tree | fd21f655f18c88ffe6f69c9ee5beff0343ce1b55 /doc/build/tutorial | |
| parent | dcbda9f1eac8bcb81c8b3b1624ffebf76627a138 (diff) | |
| download | sqlalchemy-04a72ff3a94228dcf17d104616daec0c4b6c251e.tar.gz | |
Add proper code block formatting
Change-Id: I63585eeae0b0bc78109da64520696928dfb3982c
Diffstat (limited to 'doc/build/tutorial')
| -rw-r--r-- | doc/build/tutorial/data_select.rst | 6 | ||||
| -rw-r--r-- | doc/build/tutorial/orm_data_manipulation.rst | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/doc/build/tutorial/data_select.rst b/doc/build/tutorial/data_select.rst index 16357d190..e187ab16c 100644 --- a/doc/build/tutorial/data_select.rst +++ b/doc/build/tutorial/data_select.rst @@ -628,7 +628,7 @@ and :meth:`_sql.Select.having` methods. Below we illustrate selecting user name fields as well as count of addresses, for those users that have more than one address: -.. sourcecode:: python+sql +.. sourcecode:: pycon+sql >>> with engine.connect() as conn: ... result = conn.execute( @@ -880,7 +880,7 @@ shows a series of ``User`` and ``Address`` objects, where the data for each ``Address`` object ultimately came from a subquery against the ``address`` table rather than that table directly: -.. sourcecode:: python+sql +.. sourcecode:: pycon+sql >>> subq = select(Address).where(~Address.email_address.like("%@aol.com")).subquery() >>> address_subq = aliased(Address, subq) @@ -909,7 +909,7 @@ each ``Address`` object ultimately came from a subquery against the Another example follows, which is exactly the same except it makes use of the :class:`_sql.CTE` construct instead: -.. sourcecode:: python+sql +.. sourcecode:: pycon+sql >>> cte_obj = select(Address).where(~Address.email_address.like("%@aol.com")).cte() >>> address_cte = aliased(Address, cte_obj) diff --git a/doc/build/tutorial/orm_data_manipulation.rst b/doc/build/tutorial/orm_data_manipulation.rst index 5414dd012..6cdbb9e3a 100644 --- a/doc/build/tutorial/orm_data_manipulation.rst +++ b/doc/build/tutorial/orm_data_manipulation.rst @@ -254,8 +254,8 @@ as well as the :meth:`_engine.Result.scalar_one` method): .. sourcecode:: pycon+sql - {sql}>>> sandy = session.execute(select(User).filter_by(name="sandy")).scalar_one() - BEGIN (implicit) + >>> sandy = session.execute(select(User).filter_by(name="sandy")).scalar_one() + {opensql}BEGIN (implicit) SELECT user_account.id, user_account.name, user_account.fullname FROM user_account WHERE user_account.name = ? @@ -332,8 +332,8 @@ Let's load up ``patrick`` from the database: .. sourcecode:: pycon+sql - {sql}>>> patrick = session.get(User, 3) - SELECT user_account.id AS user_account_id, user_account.name AS user_account_name, + >>> patrick = session.get(User, 3) + {opensql}SELECT user_account.id AS user_account_id, user_account.name AS user_account_name, user_account.fullname AS user_account_fullname FROM user_account WHERE user_account.id = ? @@ -485,8 +485,8 @@ and of course the database data is present again as well: .. sourcecode:: pycon+sql - {sql}>>> session.execute(select(User).where(User.name == 'patrick')).scalar_one() is patrick - SELECT user_account.id, user_account.name, user_account.fullname + >>> session.execute(select(User).where(User.name == "patrick")).scalar_one() is patrick + {opensql}SELECT user_account.id, user_account.name, user_account.fullname FROM user_account WHERE user_account.name = ? [...] ('patrick',){stop} |
