Sorry, took a while to get back to this. Really simplistic implementation here:
https://pastebin.com/kVnRMyzq
Notes:
-it doesn't do proper SQL escaping of values, just a cheesy simulacrum
-you can print the SQL instead of creating the SQLite DB by changing the `if False:` at line 127 to True
-I didn't know what to do with the `relationship_types` list, as it's only one record and doesn't seem to convey much
-Everything Is A String (TM)
1/x
I *think* this is roughly what you were looking for... I'm happy to talk through this or make changes if it's not what you intended (within reason). It's not documented, but I hope the code is clear enough to get the idea across.
I made the entity definitions dataclasses Because Reasons. They might be useful in other contexts or be easier to manipulate this way.
Have a gander!
And oh ya, there's just about 0 error handling. If it breaks, you get to keep both pieces!