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


Groups > comp.lang.python > #27887

modeling complex data with sqlalchemy

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <tyler@tysdomain.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'table.': 0.07; 'components.': 0.09; 'component': 0.15; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'message-id:@tysdomain.com': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds-solutions.net': 0.16; 'sqlalchemy,': 0.16; 'basically': 0.17; 'creates': 0.18; 'question.': 0.20; 'sort': 0.21; 'all:': 0.22; 'large,': 0.22; 'object.': 0.22; 'received:192.168.1.100': 0.22; 'setup,': 0.22; 'player': 0.23; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'object,': 0.27; 'translated': 0.27; 'project:': 0.29; 'objects': 0.29; 'url:code': 0.29; "i'm": 0.29; 'basic': 0.30; 'gets': 0.32; 'could': 0.32; 'subject:data': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'list': 0.35; 'there': 0.35; 'add': 0.36; 'living': 0.36; 'subject:with': 0.36; 'rather': 0.37; 'data': 0.37; 'easier': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'relationship': 0.60; 'back': 0.62; 'between': 0.63; 'url:p': 0.63; 'contents.': 0.65; 'game,': 0.84; 'light-weight': 0.84; 'subject:modeling': 0.84; 'care,': 0.91
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on wuff
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1
Date Sat, 25 Aug 2012 14:47:35 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
MIME-Version 1.0
To python-list@python.org
Subject modeling complex data with sqlalchemy
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3815.1345928212.4697.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1345928212 news.xs4all.nl 6921 [2001:888:2000:d::a6]:41076
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:27887

Show key headers only | 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