didier/database/scripts/db00_example.py

24 lines
576 B
Python
Raw Normal View History

2022-09-17 23:20:46 +02:00
from sqlalchemy.ext.asyncio import AsyncSession
from database.engine import DBSession
from database.schemas import UforaCourse
__all__ = ["main"]
async def main():
"""Example script: add a Ufora course"""
2022-09-17 23:20:46 +02:00
session: AsyncSession
async with DBSession() as session:
modsim = UforaCourse(
course_id=439235,
code="C003786",
name="Modelleren en Simuleren",
year=3,
compulsory=False,
role_id=785577582561067028,
)
2022-09-17 23:20:46 +02:00
session.add_all([modsim])
await session.commit()