Skip to content
Snippets Groups Projects
Commit 60d8d9c9 authored by Adrian Block's avatar Adrian Block
Browse files

🔥 removed db cli

parent 10c18283
No related branches found
No related tags found
1 merge request!3Dev
......@@ -8,7 +8,6 @@ app = typer.Typer()
app.add_typer(cli.scraper_command, name="scraper")
app.add_typer(cli.courses_command, name="courses")
app.add_typer(cli.db_command, name="db")
if __name__ == "__main__":
app()
from .scraper import scraper_command
from .courses import courses_command
from .db import db_command
import asyncio
import typer
from app import scraper, schemas
from app.database import get_session
from app.processing import mapper
db_command = typer.Typer()
@db_command.command()
def scrapesite(semester: str, site_path: str):
session = next(get_session())
courses = asyncio.run(scraper.find_and_parse_courses(site_path))
s = schemas.Semester(name=semester, courses=courses)
db_s = mapper.map_semester(s)
session.add(db_s)
session.commit()
print("Success!")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment