]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update location of get_db in SQL docs (#1293)
authorBeau Barker <beauinmelbourne@gmail.com>
Sun, 17 May 2020 10:14:14 +0000 (20:14 +1000)
committerGitHub <noreply@github.com>
Sun, 17 May 2020 10:14:14 +0000 (12:14 +0200)
docs_src/sql_databases/sql_app/main.py

index 33f63d332c4d8c47b211b2aa2d8d7c38748a40ad..e7508c59d45d0b7ab470beae7c6ab6db901f1589 100644 (file)
@@ -13,8 +13,8 @@ app = FastAPI()
 
 # Dependency
 def get_db():
+    db = SessionLocal()
     try:
-        db = SessionLocal()
         yield db
     finally:
         db.close()