Thank you for Denis who solves the first bug!
How can you have two Postgres queries in one Python method?
Example where the 2nd query is not run
def comp_func(pgmasi):
pgmasi.query("""CREATE TABLE courses (
course_id SERIAL PRIMARY KEY)""")
pgmasi.query("""CREATE TABLE files ( # not executed for some unknown reason
file_id SERIAL PRIMARY KEY""")