posts_table = sa.Table('posts', metadata,
sa.Column("id", sa.Integer, sa.Sequence
('post_id_seq'), primary_key=True),
sa.Column('userid', sa.types.Integer,
sa.ForeignKey('users.id'), nullable = False),
sa.Column('title', sa.types.String(255),
nullable = False, unique=False),
sa.Column('summary', sa.types.String(4098),
nullable = False),
....................
)
location_tags_table = sa.Table('location_tag', metadata,
sa.Column('postid', sa.types.Integer(),
sa.ForeignKey('posts.id')),
sa.Column('locationid', sa.types.Integer(),
sa.ForeignKey('locations.id')),
)
locations_table = sa.Table('locations', metadata,
sa.Column('id', sa.types.Integer(), sa.Sequence
('location_uid_seq'), primary_key=True),
sa.Column('name', sa.types.String
()),
)
class mappers
class Post(object): --> for posts_table
def __init__(self):
pass
class Location(object): --> locations_table
def __init__(self):
pass
post_table_mapper = orm.mapper(Post, posts_table, properties={
'comments':orm.relation(Comment, backref='post'),
'locations':orm.relation(Location, secondary=location_tags_table,
backref='posts'),
})
I want to get the all the locations which are popular by descending
order. How to do that?
Thanks a lot
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---