comparison Mapping.py @ 30:ee1432a91141

map the potentially long columns as Text (CLOB) not as String (VARCHAR)
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 29 Apr 2010 16:49:45 +0200
parents 74481aa49974
children 5813e3c10f14
comparison
equal deleted inserted replaced
29:74481aa49974 30:ee1432a91141
6 from sqlalchemy import ForeignKey 6 from sqlalchemy import ForeignKey
7 from sqlalchemy import Integer 7 from sqlalchemy import Integer
8 from sqlalchemy import MetaData 8 from sqlalchemy import MetaData
9 from sqlalchemy import String 9 from sqlalchemy import String
10 from sqlalchemy import Table 10 from sqlalchemy import Table
11 from sqlalchemy import Text
11 from sqlalchemy.orm import mapper 12 from sqlalchemy.orm import mapper
12 from sqlalchemy.orm import relation 13 from sqlalchemy.orm import relation
13 14
14 def createMapping(engine): 15 def createMapping(engine):
15 metadata = MetaData(engine) 16 metadata = MetaData(engine)
25 Column("create_timestamp", DateTime, nullable=False), 26 Column("create_timestamp", DateTime, nullable=False),
26 Column("read", Integer, nullable=False), 27 Column("read", Integer, nullable=False),
27 28
28 Column("id", String(255), nullable=False), 29 Column("id", String(255), nullable=False),
29 Column("link", String(255), nullable=False), 30 Column("link", String(255), nullable=False),
30 Column("title", String, nullable=False), 31 Column("title", Text, nullable=False),
31 Column("summary", String, nullable=False), 32 Column("summary", Text, nullable=False),
32 Column("updated", DateTime), 33 Column("updated", DateTime),
33 Column("feed_id", Integer, ForeignKey("feed.pk")) 34 Column("feed_id", Integer, ForeignKey("feed.pk"))
34 ) 35 )
35 36
36 metadata.create_all() 37 metadata.create_all()