Upsert AttributeError


I’ve been working on this for a long time and just can’t figure out exactly why this code doesn’t work. The Docs don’t seem to cover this error. I’ve played around with different variations over the last few days and I can’t get it. Any help appreciated!

The error is:
AttributeError: ‘dict’ object has no attribute ‘_composed_schemas’

The code is: