Changeset 18 for trunk/packages/sipb-xen-database
- Timestamp:
- Jul 15, 2007, 5:14:21 PM (17 years ago)
- svk:copy_cache_prev:
- 17
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-database/sipb-xen-database/sipb_xen_database/models.py
r13 r18 1 1 from sqlalchemy import * 2 2 3 from sqlalchemy.ext.sessioncontext import SessionContext 4 from sqlalchemy.ext.assignmapper import assign_mapper 5 3 6 meta = DynamicMetaData() 7 ctx = SessionContext(create_session) 4 8 5 9 machine_table = Table('machines', meta, … … 18 22 Column('machine_id', Integer, ForeignKey('machines.machine_id'), nullable=True), 19 23 Column('mac_addr', String, nullable=False), 20 Column('hostname', String, nullable=False)) 24 Column('ip', String, nullable=False), 25 Column('hostname', String, primary_key=True, nullable=False)) 21 26 22 27 disk_table = Table('disks', meta, … … 33 38 Column('pae', Boolean, nullable=False)) 34 39 40 41 class Machine(object): 42 pass 43 44 class NIC(object): 45 pass 46 47 class Disk(object): 48 pass 49 50 class Type(object): 51 pass 52 53 54 assign_mapper(ctx, Machine, machine_table, \ 55 properties={'nics': relation(NIC), 56 'disks': relation(Disk)}); 57 assign_mapper(ctx, NIC, nic_table) 58 assign_mapper(ctx, Disk, disk_table) 59 assign_mapper(ctx, Type, types_table) 60
Note: See TracChangeset
for help on using the changeset viewer.