Postgresql cannot drop trigger
The issue is that Postgres requires you to include the braces at the end of the function name when calling DROP FUNCTION.

If you change your code to the following, it'll work:

def downgrade():
    conn = op.get_bind()
    conn.execute(sa.sql.text('''
DROP TRIGGER update_rated_trigger ON rating;
DROP FUNCTION update_rated();
    '''))