comparison Mapping.py @ 43:12ed8b5fa08c

first system preference: configure app to stat maximized.
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 08:31:46 +0200
parents aaec263f07ca
children a8442c3487b5
comparison
equal deleted inserted replaced
42:0c0d1760b737 43:12ed8b5fa08c
1 1
2 from Feed import Feed 2 from Feed import Feed
3 from FeedEntry import FeedEntry 3 from FeedEntry import FeedEntry
4 from Preference import Preference
4 from sqlalchemy import Column 5 from sqlalchemy import Column
5 from sqlalchemy import DateTime 6 from sqlalchemy import DateTime
6 from sqlalchemy import ForeignKey 7 from sqlalchemy import ForeignKey
7 from sqlalchemy import Integer 8 from sqlalchemy import Integer
8 from sqlalchemy import MetaData 9 from sqlalchemy import MetaData
43 Column("title", Text, nullable=False), 44 Column("title", Text, nullable=False),
44 Column("summary", Text, nullable=False), 45 Column("summary", Text, nullable=False),
45 Column("updated", DateTime), 46 Column("updated", DateTime),
46 Column("feed_id", Integer, ForeignKey("feed.pk")) 47 Column("feed_id", Integer, ForeignKey("feed.pk"))
47 ) 48 )
49
50 preferencesTable = Table("preference", metadata,
51 Column("pk", Integer, primary_key=True),
52 Column("key", String(255), nullable=False),
53 Column("value", String(255), nullable=False)
54 )
48 55
49 metadata.create_all() 56 metadata.create_all()
50 57
51 mapper(FeedEntry, feedEntryTable) 58 mapper(FeedEntry, feedEntryTable)
52 mapper(Feed, feedTable, 59 mapper(Feed, feedTable,
53 properties = { 60 properties = {
54 "entries" : relation(FeedEntry, backref="feed") 61 "entries" : relation(FeedEntry, backref="feed")
55 } 62 }
56 ) 63 )
64 mapper(Preference, preferencesTable)