mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Stash
This commit is contained in:
parent
eee0a38afa
commit
3ca4520e56
1 changed files with 23 additions and 0 deletions
23
database/scripts/db05_ufora_courses_23_24.py
Normal file
23
database/scripts/db05_ufora_courses_23_24.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from typing import Optional
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from database.engine import DBSession
|
||||
from database.schemas import UforaCourse
|
||||
|
||||
__all__ = ["main"]
|
||||
|
||||
|
||||
async def main():
|
||||
"""Add the Ufora courses for the 2023-2024 academic year"""
|
||||
session: AsyncSession
|
||||
async with DBSession() as session:
|
||||
# Remove Advanced Databases (which no longer exists)
|
||||
stmt = select(UforaCourse).where(UforaCourse.code == "E018441")
|
||||
advanced_databases_course: Optional[UforaCourse] = (await session.execute(stmt)).scalar_one_or_none()
|
||||
|
||||
await session.delete(advanced_databases_course)
|
||||
await session.commit()
|
||||
|
||||
# TODO rest of courses when I know them
|
||||
Loading…
Add table
Add a link
Reference in a new issue