Makes no sense to fetch the entire entity when you only need the key, it should be:
sourceTypeKey = self.session().query(SourceTypeMapped.Key).join(SourceMapped, SourceTypeMapped.id == SourceMapped.typeId).filter(SourceMapped.Id == sourceId).one()
if sourceTypeKey in SOURCES_AUTO_DELETE: ...