diff --git a/README.md b/README.md index ac1c1bd..d91f635 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,7 @@ PYTHONPATH=. pytest tests/units ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Author + +- Made with ❤️ and ☕️ by [Jose Cerrejon](mailto:ulysess@gmail.com). diff --git a/app/db/database.py b/app/db/database.py new file mode 100644 index 0000000..97c2ed7 --- /dev/null +++ b/app/db/database.py @@ -0,0 +1,20 @@ +from sqlalchemy import create_engine +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import sessionmaker + +SQLALCHEMY_DATABASE_URL = "sqlite:///./DB.db" + +engine = create_engine(SQLALCHEMY_DATABASE_URL) + +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) + +Base = declarative_base() + + +def get_db(): + Base.metadata.create_all(bind=engine) + db = SessionLocal() + try: + yield db + finally: + db.close()