1 from types import StringTypes
6 from PLC.Faults import *
7 from PLC.Parameter import Parameter, Mixed
8 from PLC.Filter import Filter
9 from PLC.Debug import profile
10 from PLC.Timestamp import Timestamp
11 from PLC.Storage.AlchemyObject import AlchemyObj
13 class PCUNode(AlchemyObj):
15 Representation of a row in the pcu_node table. To use, optionally
16 instantiate with a dict of values. Update as you would a
17 dict. Commit to the database with sync().To use, instantiate
18 with a dict of values.
21 tablename = 'pcu_node'
24 'pcu_id': Parameter(int, "PCU identifier", primary_key=True),
25 'node_id': Parameter(int, "Node identifier", indexed=True),
30 def sync(self, commit = True, validate=True):
34 AlchemyObj.sync(self, commit, validate)
35 AlchemyObj.insert(self, dict(self))
37 def delete(self, commit = True):
39 Delete existing slice.
41 AlchemyObj.delete(self, dict(self))
46 Representation of row(s) from the slices table in the
50 def __init__(self, api, filter = None, columns = None):
52 # the view that we're selecting upon: start with view_slices
54 pcu_nodes = PCUNode().select()
55 elif isinstance(filter, dict):
56 pcu_nodes = PCUNode().select(filter=filter)
58 raise PLCInvalidArgument, "Wrong pcu_node filter %r"%filter
60 for pcu_node in pcu_nodes:
61 self.append(PCUNode(api, object=pcu_node))