[sqlalchemy] Re: ORM mapping existing data tables

2008-09-21 Thread Michael Bayer
On Sep 21, 2008, at 9:09 PM, Doug Farrell wrote: > > Hi everyone, > > I'm new to SqlAlchemy, but I've got some things working and really am > enjoying it. Right now I'm trying to ORM map some existing MySQL > database tables to a class. I've read the documentation, I guess I'm > just not getting

[sqlalchemy] ORM mapping existing data tables

2008-09-21 Thread Doug Farrell
Hi everyone, I'm new to SqlAlchemy, but I've got some things working and really am enjoying it. Right now I'm trying to ORM map some existing MySQL database tables to a class. I've read the documentation, I guess I'm just not getting it. Can someone help me out. I've done this: # initialize the

[sqlalchemy] Re: Querying in the many side of a one-to-many relationship

2008-09-21 Thread Gabe
Hi, Thanks for the pointer. I must have read over that 100 times and missed the contains part. I've managed to put this together: games = (session.query(models.Game).options( sqlalchemy.orm.eagerload('scores')).filter( models.Game.scores.any(models.Score.player == player)).all())

[sqlalchemy] Re: Querying in the many side of a one-to-many relationship

2008-09-21 Thread az
see these http://www.sqlalchemy.org/docs/05/ormtutorial.html#datamapping_joins_relationop On Sunday 21 September 2008 20:04:02 Gabe wrote: > Hi Everyone, > I'm somewhat new to database design, so if I've set things up in an > incompatible or silly manner please let me know. I have the > followin

[sqlalchemy] dictionary mapping with foreignkey relations/association objects

2008-09-21 Thread mattmiller
greetings, i don't seem to be able to figure out how to map an input dictionary to my objects. specifically, i am trying to map a dictionary with inut values to my session objects. somewhat stylized, using a non- declarative approach: book_table = Table('test_book', meta, Column(u'id', Intege

[sqlalchemy] Querying in the many side of a one-to-many relationship

2008-09-21 Thread Gabe
Hi Everyone, I'm somewhat new to database design, so if I've set things up in an incompatible or silly manner please let me know. I have the following tables: class Player(Base): __tablename__ = "players" # Stuff about a player. class Game(Base): """A class that holds information about