First commit.

This commit is contained in:
Yaro Kasear 2025-08-26 09:01:15 -05:00
commit a3e676a0b0
13 changed files with 346 additions and 0 deletions

19
example_app/seed.py Normal file
View file

@ -0,0 +1,19 @@
from .app import SessionLocal, engine
from .models import Base, Author, Book
def run():
Base.metadata.create_all(engine)
s = SessionLocal()
a1 = Author(name="Ursula K. Le Guin")
a2 = Author(name="Octavia E. Butler")
s.add_all([
a1, a2,
Book(title="The Left Hand of Darkness", author=a1),
Book(title="A Wizard of Earthsea", author=a1),
Book(title="Parable of the Sower", author=a2),
])
s.commit()
s.close()
if __name__ == "__main__":
run()