Created
May 26, 2022 19:26
-
-
Save BetterProgramming/83edee29166269f0e622f81ca85e6a1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#main.py | |
from fastapi import FastAPI,Body, Depends | |
import schemas | |
import models | |
from database import Base, engine, SessionLocal | |
from sqlalchemy.orm import Session | |
#This will create our database if it doesent already exists | |
Base.metadata.create_all(engine) | |
def get_session(): | |
session = SessionLocal() | |
try: | |
yield session | |
finally: | |
session.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment