<aside> 💡

Psycopg2 allows us to write Python scripts that connect to a PostgreSQL database and execute SQL statements. Psycopg2 is the most popular PostgreSQL adapter for Python.

</aside>

General Steps

SQL Injections

Python stuff

Tutorial Questions

createdb uni
psql uni -f /home/cs3311/web/23T1/lectures/week07-tuesday/exercises/uni.dump
People(id, family, given, fullname, birthday, origin)

Students(id)

Subjects(id, code, name, uoc, offeredby, ...)
Courses(id, subject, term, homepage)
Streams(id, code, name, offeredby, stype, ...)
Programs(id, code, name, uoc, offeredby, ...)

Terms(id, year, ttype, code, name, starting, ending)

Course_enrolments(student, course, mark, grade)
Stream_enrolments(part_of_prog_enr, stream)
Program_enrolments(id, student, term, program, ...)

OrgUnits(id, utype, name, longname, unswid)
OrgUnit_Types(id, name)