mirror of
https://github.com/fastapi/sqlmodel.git
synced 2025-08-14 17:41:37 +08:00
🎨 Update inline source examples, hide #
in annotations (from MkDocs Material) (#677)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
@ -43,16 +43,16 @@ def create_heroes():
|
||||
|
||||
def update_heroes():
|
||||
with Session(engine) as session:
|
||||
statement = select(Hero).where(Hero.name == "Spider-Boy") # (1)
|
||||
results = session.exec(statement) # (2)
|
||||
hero = results.one() # (3)
|
||||
print("Hero:", hero) # (4)
|
||||
statement = select(Hero).where(Hero.name == "Spider-Boy") # (1)!
|
||||
results = session.exec(statement) # (2)!
|
||||
hero = results.one() # (3)!
|
||||
print("Hero:", hero) # (4)!
|
||||
|
||||
hero.age = 16 # (5)
|
||||
session.add(hero) # (6)
|
||||
session.commit() # (7)
|
||||
session.refresh(hero) # (8)
|
||||
print("Updated hero:", hero) # (9)
|
||||
hero.age = 16 # (5)!
|
||||
session.add(hero) # (6)!
|
||||
session.commit() # (7)!
|
||||
session.refresh(hero) # (8)!
|
||||
print("Updated hero:", hero) # (9)!
|
||||
|
||||
|
||||
def main():
|
||||
|
Reference in New Issue
Block a user