Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #27887

modeling complex data with sqlalchemy

Date 2012-08-25 14:47 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
Subject modeling complex data with sqlalchemy
Newsgroups comp.lang.python
Message-ID <mailman.3815.1345928212.4697.python-list@python.org> (permalink)

Show all headers | View raw


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,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

modeling complex data with sqlalchemy "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-08-25 14:47 -0600

csiph-web