Mercurial > hg > Feedworm
comparison Mapping.py @ 2:8a624ee48a74
First skeleton for sqlalchemy: define the mapping and create the first feed
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 26 Apr 2010 17:40:55 +0200 |
parents | |
children | e0199f383442 |
comparison
equal
deleted
inserted
replaced
1:8b0280b4bb09 | 2:8a624ee48a74 |
---|---|
1 | |
2 from Feed import Feed | |
3 from sqlalchemy import Column | |
4 from sqlalchemy import Integer | |
5 from sqlalchemy import MetaData | |
6 from sqlalchemy import String | |
7 from sqlalchemy import Table | |
8 from sqlalchemy.orm import mapper | |
9 | |
10 def createMapping(engine): | |
11 metadata = MetaData(engine) | |
12 | |
13 feedTable = Table("feed", metadata, | |
14 Column("pk", Integer, primary_key=True), | |
15 Column("name", String(255), nullable=False), | |
16 Column("url", String(255), nullable=False) | |
17 ) | |
18 | |
19 metadata.create_all() | |
20 | |
21 mapper(Feed, feedTable) |