modeling complex data with sqlalchemy


Littlefield, Tyler

Hello all:
I had a quick question.
In my game, I have an is-a setup, where all objects contain data like an
id for sqlalchemy, a name, a description and a list of contents.
In order to add functionality to an object, you add components. So for
example, a player would have the Player and Living component associated
with the basic object. It's sort of a way to give myself a way to add
functionality without having a lot of multiple inheritance.
This creates a problem for me though, since it looks like each component
would have it's own table. How would you go about modeling the 1:n
relationship between entity and each component?
Also, I'm going to have a location property on the object, which is
basically it's location (a reference to another Entity), or None if it
has no parent. How would you set that up in SA so that location gets
translated to an ID and then translated back to the required object?
Might there be another easier way to model all this data? It looks like
this database could get rather large, extremely quickly.

Take care,
The aspen project: a barebones light-weight mud engine:
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads