1 |
Help on module ViewObjectLayer:
|
2 |
|
3 |
NAME
|
4 |
ViewObjectLayer
|
5 |
|
6 |
FILE
|
7 |
/Users/gregorygraham/druid/cms_dm_dev/importAgent/Python/ViewObjectLayer.py
|
8 |
|
9 |
CLASSES
|
10 |
RowInterface
|
11 |
Row(RowInterface, __builtin__.dict)
|
12 |
SchemaInterface
|
13 |
MultiSchema
|
14 |
SingleSchema
|
15 |
TableInterface
|
16 |
Table
|
17 |
genException.genException(exceptions.Exception)
|
18 |
AbstractMethodException
|
19 |
ViewObjectLayerException
|
20 |
|
21 |
class AbstractMethodException(genException.genException)
|
22 |
| Exception class for creating interfaces
|
23 |
|
|
24 |
| Method resolution order:
|
25 |
| AbstractMethodException
|
26 |
| genException.genException
|
27 |
| exceptions.Exception
|
28 |
|
|
29 |
| Methods defined here:
|
30 |
|
|
31 |
| __init__(self, **kwargs)
|
32 |
| Constructor
|
33 |
|
|
34 |
| ----------------------------------------------------------------------
|
35 |
| Methods inherited from genException.genException:
|
36 |
|
|
37 |
| __str__(self)
|
38 |
| Generate string representation of error.
|
39 |
|
|
40 |
| ----------------------------------------------------------------------
|
41 |
| Methods inherited from exceptions.Exception:
|
42 |
|
|
43 |
| __getitem__(...)
|
44 |
|
45 |
class MultiSchema(SchemaInterface)
|
46 |
| This class represents the product of composing together schema
|
47 |
| representing different tables.
|
48 |
|
|
49 |
| Methods defined here:
|
50 |
|
|
51 |
| __init__(self, fkExcl=[])
|
52 |
| Constructor
|
53 |
|
|
54 |
| addCondition(self, condition)
|
55 |
| Adds a list of conditions to the schema. Implements
|
56 |
| SchemaInterface::addCondition()
|
57 |
|
|
58 |
| addSchema(self, schema, nary=0)
|
59 |
| Adds a simple schema to the MultiSchema.
|
60 |
| Takes an instance of SimpleSchmea, and a flag to indicate if
|
61 |
| many to one is desired.
|
62 |
|
|
63 |
| addSeq(self, attribute, val=-1)
|
64 |
| Declares a sequencer on attribute. Does not reset existing values. Implements
|
65 |
| SchemaInterface::addSeq().
|
66 |
|
|
67 |
| attributes(self)
|
68 |
| Returns the attributes in the CompositeTable.
|
69 |
| All attributes of components by table name are
|
70 |
| included. Implements SchemaInterface::attributes().
|
71 |
|
|
72 |
| defaults(self, attribute)
|
73 |
| Returns the default value of an attribute. The attribute should be given
|
74 |
| in table.attribute format, but it will attempt to find a match if not.
|
75 |
| Implements SchemaInterface::defaults().
|
76 |
|
|
77 |
| foreignKeys(self, flag=1)
|
78 |
| Accessor to foreign key definitions. Will return a dictionary
|
79 |
| of all foreign key definitions by default. If the first bit is set,
|
80 |
| then foreign keys that refer to the same table are excluded from
|
81 |
| the list. If the second bit is set, then foreign keys that refer to
|
82 |
| defferent tables but are still within the composite table are excluded.
|
83 |
| If the third bit is set then external references are excluded.
|
84 |
| If the fourth bit is set, foreign keys that are also in the join
|
85 |
| conditions are excluded. The output format is
|
86 |
| {table1.attr1 : table2:attr2} where the sense is that table1:attr1
|
87 |
| references table2:attr2. Implements SchemaInterface::foreignKeys().
|
88 |
|
|
89 |
| getConditions(self)
|
90 |
| Accessor returns list of view conditions
|
91 |
| Implements SchemaInterface::viewConditions
|
92 |
|
|
93 |
| getNextSeq(self, attribute)
|
94 |
| Gets the next integer in sequence for attribute is it
|
95 |
| has a sequencer defined. Uses TableName.Attribute name
|
96 |
| for the attribute. Implements SchemaInterface::getNextSeq().
|
97 |
|
|
98 |
| info(self, subselect, field)
|
99 |
| Returns information about the selected subschema in subselect.
|
100 |
| If field is "FKList", a list of foreign keys exported by the
|
101 |
| subschema into the existing schema is returned. If field is
|
102 |
| "Nary", a 0 or 1 is returned is the relationship expected is
|
103 |
| one to one or one to many respectively. If field is something
|
104 |
| else, None is returned. Implements SchemaInterface::info().
|
105 |
|
|
106 |
| matchAttribute(self, attr)
|
107 |
| Maps attribute to table.attribute(fkey) format. For MultiSchema,
|
108 |
| this may not always return a unique attribute. Implements
|
109 |
| SchemaInterface::matchAttribute().
|
110 |
|
|
111 |
| names(self)
|
112 |
| Returns the list of Component table names.
|
113 |
| This is empty until ComponentTables are added.
|
114 |
| Implements SchemaInterface::names()
|
115 |
|
|
116 |
| notNull(self)
|
117 |
| Returns the defined not null constraints,
|
118 |
| format is TableName.AttributeName. Implements
|
119 |
| SchemaInterface::notNull.
|
120 |
|
|
121 |
| primaryKey(self)
|
122 |
| Returns the primary key attributes. Implements
|
123 |
| SchemaInterface::primaryKey().
|
124 |
|
|
125 |
| sequences(self)
|
126 |
| This returns the existing attributes with sequencers defined.
|
127 |
| Implements SchemaInterface::sequences().
|
128 |
|
|
129 |
| setSeq(self, attribute, val)
|
130 |
| Sets the value of a sequencer. Implements SchemaInterface::setSeq().
|
131 |
|
|
132 |
| subSchema(self, selector)
|
133 |
| For MultiSchema, this returns the subschema named by the selector.
|
134 |
| If selector equals None, it then returns self. Implements
|
135 |
| SchemaInterface::subSchema().
|
136 |
|
|
137 |
| types(self, attribute)
|
138 |
| Returns the type of an attribute. The attribute should be given
|
139 |
| in table.attribute format, but it will attempt to find a match if not.
|
140 |
| Implements SchemaInterface::types().
|
141 |
|
|
142 |
| uniqueKeys(self)
|
143 |
| This function does not find all of the unique keys.
|
144 |
| Rather, we look for tables tht appear in the primary key
|
145 |
| attributes and list direct products of unique keys from
|
146 |
| those tables only on the strength that a unique key is
|
147 |
| functionally dependent on the primary key. Implements
|
148 |
| SchemaInterface::uniqueKeys().
|
149 |
|
|
150 |
| ----------------------------------------------------------------------
|
151 |
| Data and other attributes inherited from SchemaInterface:
|
152 |
|
|
153 |
| expr = r"matchAttribute.__doc__ = '\n Abstract definition for interf...
|
154 |
|
|
155 |
| method = 'matchAttribute'
|
156 |
|
157 |
class Row(RowInterface, __builtin__.dict)
|
158 |
| Row object for the CompositeTable class.
|
159 |
| In order to satisfy the one to many relationships and
|
160 |
| possible multiple foreign key references to the same table,
|
161 |
| the structure is more complicated than a simple one table
|
162 |
| row object.
|
163 |
|
|
164 |
| Method resolution order:
|
165 |
| Row
|
166 |
| RowInterface
|
167 |
| __builtin__.dict
|
168 |
| __builtin__.object
|
169 |
|
|
170 |
| Methods defined here:
|
171 |
|
|
172 |
| __getitem__(self, key, index=None)
|
173 |
| Overrides dict::__getitem__() to restrict domain to
|
174 |
| possibleKeys(). If key points to an n-ary list
|
175 |
| of subrows, the last row only is used to get the value.
|
176 |
| Optional index can be given to get data from the ith subrow.
|
177 |
|
|
178 |
| __init__(self, parSchema)
|
179 |
| Constructor takes parent table reference as argument.
|
180 |
| An optional list of attributes to ignore when finding
|
181 |
| foreign keys can be given.
|
182 |
|
|
183 |
| __setitem__(self, key, value, allFlag=0)
|
184 |
| Overrides dict::__setitem__() to restrict domain to
|
185 |
| possibleKeys(). If key points to an n-ary list
|
186 |
| of subrows, the last row only is set. If allFlag is 1,
|
187 |
| then all rows in an n-ary list get set.
|
188 |
|
|
189 |
| availableSchemas(self)
|
190 |
| Returns a list of available schemas. Each schema in
|
191 |
| this list corresponds to exactly one table.
|
192 |
| Implements RowInterface::availableSchemas().
|
193 |
|
|
194 |
| fixRow(self, fKeyConditions, joinConditions, reverse=0)
|
195 |
| Fixes up a row according to conditions
|
196 |
| (a) Foreign key conditions are fixed in the direction
|
197 |
| refered --> referer. This overwrites any previous
|
198 |
| value in referer.
|
199 |
| (b) Join conditions are fixed in the direction of
|
200 |
| non-None value to None value. If both sides are None,
|
201 |
| nothing happens. If both side are not None and unequal,
|
202 |
| an exception is thrown.
|
203 |
| Implements RowInterface::fixRow()
|
204 |
|
|
205 |
| getData(self, schemaName, fkey=None)
|
206 |
| For the given schemaName in RowInterface::availableSchemas(),
|
207 |
| return data corresponding only to that schema. Implements
|
208 |
| RowInterface::getData().
|
209 |
|
|
210 |
| keys(self)
|
211 |
| Overrides dict::keys() to restrict domain to possibleKeys().
|
212 |
|
|
213 |
| matchAttribute(self, attr)
|
214 |
| Convenience method to access SchemaInterface::matchAttribute().
|
215 |
|
|
216 |
| newData(self, schemaName)
|
217 |
| If schemaInfo(schemaName)['Nary'] > 0, then new data can
|
218 |
| be added to the schema corresponding to schemaName without
|
219 |
| creating a new row. Implements RowInterface::newData().
|
220 |
|
|
221 |
| parentSchema(self)
|
222 |
| Accessor to the SchemaInterface corresponding
|
223 |
| to this row. Implements RowInterface::parentSchema().
|
224 |
|
|
225 |
| possibleKeys(self)
|
226 |
| Convenience method to access a list of all possible attributes
|
227 |
| of the Row. Implements RowInterface::possibleKeys().
|
228 |
|
|
229 |
| schemaInfo(self, selector)
|
230 |
| Returns info on one to one/many relationships and foreign
|
231 |
| key target lists. (See SchemaInterface::info().)
|
232 |
| Implements RowInterface::schemaInfo()
|
233 |
|
|
234 |
| setSkipOnEmpty(self, schemaName=None)
|
235 |
| Adds a schema name to the list of schemas that are allowed
|
236 |
| to have empty data. Insert algrithms should not throw an
|
237 |
| exception in that case. Implements RowInterface::skipOnEmpty().
|
238 |
|
|
239 |
| skipOnEmpty(self, schemaName)
|
240 |
| Returns 0 or 1 if the row cannot be skipped (or can) in case
|
241 |
| of empty row. Insert algrithms should not throw an
|
242 |
| exception in that case. Implements RowInterface::skipOnEmpty().
|
243 |
|
|
244 |
| ----------------------------------------------------------------------
|
245 |
| Data and other attributes defined here:
|
246 |
|
|
247 |
| __dict__ = <dictproxy object at 0x50f6f0>
|
248 |
| dictionary for instance variables (if defined)
|
249 |
|
|
250 |
| __weakref__ = <attribute '__weakref__' of 'Row' objects>
|
251 |
| list of weak references to the object (if defined)
|
252 |
|
|
253 |
| ----------------------------------------------------------------------
|
254 |
| Data and other attributes inherited from RowInterface:
|
255 |
|
|
256 |
| expr = r"fixRow.__doc__ = '\n Abstract definition for interface meth...
|
257 |
|
|
258 |
| method = 'fixRow'
|
259 |
|
|
260 |
| ----------------------------------------------------------------------
|
261 |
| Methods inherited from __builtin__.dict:
|
262 |
|
|
263 |
| __cmp__(...)
|
264 |
| x.__cmp__(y) <==> cmp(x,y)
|
265 |
|
|
266 |
| __contains__(...)
|
267 |
| D.__contains__(k) -> True if D has a key k, else False
|
268 |
|
|
269 |
| __delitem__(...)
|
270 |
| x.__delitem__(y) <==> del x[y]
|
271 |
|
|
272 |
| __eq__(...)
|
273 |
| x.__eq__(y) <==> x==y
|
274 |
|
|
275 |
| __ge__(...)
|
276 |
| x.__ge__(y) <==> x>=y
|
277 |
|
|
278 |
| __getattribute__(...)
|
279 |
| x.__getattribute__('name') <==> x.name
|
280 |
|
|
281 |
| __gt__(...)
|
282 |
| x.__gt__(y) <==> x>y
|
283 |
|
|
284 |
| __hash__(...)
|
285 |
| x.__hash__() <==> hash(x)
|
286 |
|
|
287 |
| __iter__(...)
|
288 |
| x.__iter__() <==> iter(x)
|
289 |
|
|
290 |
| __le__(...)
|
291 |
| x.__le__(y) <==> x<=y
|
292 |
|
|
293 |
| __len__(...)
|
294 |
| x.__len__() <==> len(x)
|
295 |
|
|
296 |
| __lt__(...)
|
297 |
| x.__lt__(y) <==> x<y
|
298 |
|
|
299 |
| __ne__(...)
|
300 |
| x.__ne__(y) <==> x!=y
|
301 |
|
|
302 |
| __repr__(...)
|
303 |
| x.__repr__() <==> repr(x)
|
304 |
|
|
305 |
| clear(...)
|
306 |
| D.clear() -> None. Remove all items from D.
|
307 |
|
|
308 |
| copy(...)
|
309 |
| D.copy() -> a shallow copy of D
|
310 |
|
|
311 |
| get(...)
|
312 |
| D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
|
313 |
|
|
314 |
| has_key(...)
|
315 |
| D.has_key(k) -> True if D has a key k, else False
|
316 |
|
|
317 |
| items(...)
|
318 |
| D.items() -> list of D's (key, value) pairs, as 2-tuples
|
319 |
|
|
320 |
| iteritems(...)
|
321 |
| D.iteritems() -> an iterator over the (key, value) items of D
|
322 |
|
|
323 |
| iterkeys(...)
|
324 |
| D.iterkeys() -> an iterator over the keys of D
|
325 |
|
|
326 |
| itervalues(...)
|
327 |
| D.itervalues() -> an iterator over the values of D
|
328 |
|
|
329 |
| pop(...)
|
330 |
| D.pop(k[,d]) -> v, remove specified key and return the corresponding value
|
331 |
| If key is not found, d is returned if given, otherwise KeyError is raised
|
332 |
|
|
333 |
| popitem(...)
|
334 |
| D.popitem() -> (k, v), remove and return some (key, value) pair as a
|
335 |
| 2-tuple; but raise KeyError if D is empty
|
336 |
|
|
337 |
| setdefault(...)
|
338 |
| D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
|
339 |
|
|
340 |
| update(...)
|
341 |
| D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k]
|
342 |
| (if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]
|
343 |
|
|
344 |
| values(...)
|
345 |
| D.values() -> list of D's values
|
346 |
|
|
347 |
| ----------------------------------------------------------------------
|
348 |
| Data and other attributes inherited from __builtin__.dict:
|
349 |
|
|
350 |
| __new__ = <built-in method __new__ of type object at 0x101016f0>
|
351 |
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
352 |
|
|
353 |
| fromkeys = <built-in method fromkeys of type object at 0x119ee0>
|
354 |
| dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
|
355 |
| v defaults to None.
|
356 |
|
357 |
class RowInterface
|
358 |
| Interface definition for a row class. The row should be a dict, but
|
359 |
| it should also have methods to handle special cases.
|
360 |
|
|
361 |
| Methods defined here:
|
362 |
|
|
363 |
| __init__(self)
|
364 |
| Constructor - Abstract class definition
|
365 |
| Checks that methods declared in the public interface are actually defined.
|
366 |
|
|
367 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='availableSchemas'
|
368 |
| Abstract definition for interface method availableSchemas()
|
369 |
|
|
370 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='fixRow'
|
371 |
| Abstract definition for interface method fixRow()
|
372 |
|
|
373 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='getData'
|
374 |
| Abstract definition for interface method getData()
|
375 |
|
|
376 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='matchAttribute'
|
377 |
| Abstract definition for interface method matchAttribute()
|
378 |
|
|
379 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='newData'
|
380 |
| Abstract definition for interface method newData()
|
381 |
|
|
382 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='parentSchema'
|
383 |
| Abstract definition for interface method parentSchema()
|
384 |
|
|
385 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='possibleKeys'
|
386 |
| Abstract definition for interface method possibleKeys()
|
387 |
|
|
388 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='schemaInfo'
|
389 |
| Abstract definition for interface method schemaInfo()
|
390 |
|
|
391 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='setSkipOnEmpty'
|
392 |
| Abstract definition for interface method setSkipOnEmpty()
|
393 |
|
|
394 |
| lambdaself, x='ViewObjectLayer', y='RowInterface', z='skipOnEmpty'
|
395 |
| Abstract definition for interface method skipOnEmpty()
|
396 |
|
|
397 |
| ----------------------------------------------------------------------
|
398 |
| Data and other attributes defined here:
|
399 |
|
|
400 |
| expr = r"fixRow.__doc__ = '\n Abstract definition for interface meth...
|
401 |
|
|
402 |
| method = 'fixRow'
|
403 |
|
404 |
class SchemaInterface
|
405 |
| This interface defines methods to access and manipulate relational
|
406 |
| database constraints on a single table or multi-table view.
|
407 |
|
|
408 |
| Methods defined here:
|
409 |
|
|
410 |
| __init__(self)
|
411 |
| Constructor - Check that method definitions declared in
|
412 |
| the public interface are actually defined.
|
413 |
|
|
414 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='addCondition'
|
415 |
| Abstract definition for interface method addCondition()
|
416 |
|
|
417 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='addSeq'
|
418 |
| Abstract definition for interface method addSeq()
|
419 |
|
|
420 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='attributes'
|
421 |
| Abstract definition for interface method attributes()
|
422 |
|
|
423 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='defaults'
|
424 |
| Abstract definition for interface method defaults()
|
425 |
|
|
426 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='foreignKeys'
|
427 |
| Abstract definition for interface method foreignKeys()
|
428 |
|
|
429 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='getConditions'
|
430 |
| Abstract definition for interface method getConditions()
|
431 |
|
|
432 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='getNextSeq'
|
433 |
| Abstract definition for interface method getNextSeq()
|
434 |
|
|
435 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='info'
|
436 |
| Abstract definition for interface method info()
|
437 |
|
|
438 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='matchAttribute'
|
439 |
| Abstract definition for interface method matchAttribute()
|
440 |
|
|
441 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='names'
|
442 |
| Abstract definition for interface method names()
|
443 |
|
|
444 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='notNull'
|
445 |
| Abstract definition for interface method notNull()
|
446 |
|
|
447 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='primaryKey'
|
448 |
| Abstract definition for interface method primaryKey()
|
449 |
|
|
450 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='sequences'
|
451 |
| Abstract definition for interface method sequences()
|
452 |
|
|
453 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='setSeq'
|
454 |
| Abstract definition for interface method setSeq()
|
455 |
|
|
456 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='subSchema'
|
457 |
| Abstract definition for interface method subSchema()
|
458 |
|
|
459 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='types'
|
460 |
| Abstract definition for interface method types()
|
461 |
|
|
462 |
| lambdaself, x='ViewObjectLayer', y='SchemaInterface', z='uniqueKeys'
|
463 |
| Abstract definition for interface method uniqueKeys()
|
464 |
|
|
465 |
| ----------------------------------------------------------------------
|
466 |
| Data and other attributes defined here:
|
467 |
|
|
468 |
| expr = r"matchAttribute.__doc__ = '\n Abstract definition for interf...
|
469 |
|
|
470 |
| method = 'matchAttribute'
|
471 |
|
472 |
class SingleSchema(SchemaInterface)
|
473 |
| Class to represent schema from a single database table.
|
474 |
|
|
475 |
| Methods defined here:
|
476 |
|
|
477 |
| __init__(self, name, attributes, types, pk, uk, fk, nn, df, sq, conditions=[])
|
478 |
| This implementation of SchemaInterface is for a single table definition.
|
479 |
|
|
480 |
| addCondition(self, condition)
|
481 |
| Adds a list of conditions to the schema. Implements
|
482 |
| SchemaInterface::addCondition()
|
483 |
|
|
484 |
| addSeq(self, item, value=-1)
|
485 |
| Declares a sequencer on attribute. Does not reset existing values. Implements
|
486 |
| SchemaInterface::addSeq().
|
487 |
|
|
488 |
| attributes(self)
|
489 |
| Accessor to table attribtes. Returns all attrbutes in a list.
|
490 |
| Implements SchemaInterface::attributes()
|
491 |
|
|
492 |
| defaults(self, attribute)
|
493 |
| Accessor to attribute defaults. Will return a string describing the
|
494 |
| default value of the given attribute, or None if it was not defined.
|
495 |
| Implements SchemaInterface::types().
|
496 |
|
|
497 |
| foreignKeys(self, flag=1)
|
498 |
| Accessor to foreign key definitions. Will return a dictionary
|
499 |
| of all foreign key definitions by default. If the first bit is set,
|
500 |
| then foreign keys that refer to the same table are excluded from
|
501 |
| the list. The output format is {attr1 : table2:attr2} where
|
502 |
| the sense is that attr1 references table2:attr2. (table1 is
|
503 |
| understood to be this table.) Implements SchemaInterface::foreignKeys()
|
504 |
|
|
505 |
| getConditions(self)
|
506 |
| Accessor returns list of view conditions. Implements
|
507 |
| SchemaInterface::getConditions()
|
508 |
|
|
509 |
| getNextSeq(self, item)
|
510 |
| For the given attribute, this increments the associated sequence
|
511 |
| counter and returns its value. If no counter was defined, then
|
512 |
| it raises an error. Implements SchemaInterface::getNextSeq().
|
513 |
|
|
514 |
| info(self, selector, field)
|
515 |
| Returns information about the selected subschema in selector.
|
516 |
| If field is "FKList", a list of foreign keys exported by the
|
517 |
| subschema into the existing schema is returned. If field is
|
518 |
| "Nary", a 0 or 1 is returned is the relationship expected is
|
519 |
| one to one or one to many respectively. If field is something
|
520 |
| else, None is returned. Implements SchemaInterface::info().
|
521 |
|
|
522 |
| matchAttribute(self, attr)
|
523 |
| Maps attribute to table.attribute format. For SingleSchema,
|
524 |
| this always returns a unique attribute. Implements
|
525 |
| SchemaInterface::matchAttribute().
|
526 |
|
|
527 |
| names(self)
|
528 |
| Accessor to the table name. Returns a list of string names.
|
529 |
| For a SingleSchema, this list always has one element in it.
|
530 |
| Implements SchemaInterface::names().
|
531 |
|
|
532 |
| notNull(self)
|
533 |
| Accessor returns 1 (true) if the given attribute is not nullable
|
534 |
| or 0 (false) if it is allowed to be null. Implements
|
535 |
| SchemaInterface::notNull().
|
536 |
|
|
537 |
| primaryKey(self)
|
538 |
| Accessor to primary key attributes. This will return a list
|
539 |
| of the attributes. Implements SchemaInterface::primaryKey()
|
540 |
|
|
541 |
| sequences(self)
|
542 |
| This returns the existing attributes with sequencers defined.
|
543 |
| Implements SchemaInterface::sequences().
|
544 |
|
|
545 |
| setSeq(self, item, val=-1)
|
546 |
| Sets the value of a sequencer. Implements SchemaInterface::setSeq().
|
547 |
|
|
548 |
| subSchema(self, selector)
|
549 |
| For SingleSchema, this checks that the subschema asked for
|
550 |
| is the same as self, and then returns self. Implements
|
551 |
| SchemaInterface::subSchema().
|
552 |
|
|
553 |
| types(self, attribute)
|
554 |
| Accessor to attribute types. Will return a string describing the
|
555 |
| type of the given attribute. Implements SchemaInterface::types().
|
556 |
|
|
557 |
| uniqueKeys(self)
|
558 |
| Accessor to list of unique keys. Returns a list of all unique
|
559 |
| keys defined on the table, each of which is a list of attributes.
|
560 |
| Implements SchemaInterface::uniqueKeys().
|
561 |
|
|
562 |
| ----------------------------------------------------------------------
|
563 |
| Data and other attributes inherited from SchemaInterface:
|
564 |
|
|
565 |
| expr = r"matchAttribute.__doc__ = '\n Abstract definition for interf...
|
566 |
|
|
567 |
| method = 'matchAttribute'
|
568 |
|
569 |
class Table(TableInterface)
|
570 |
| This class represents a database view with schema,
|
571 |
| elementary operations, and a physical connection. The
|
572 |
| schema can be either any object that implements the
|
573 |
| SchemaInterface. Data is exchanged with the Table in
|
574 |
| objects that implement the RowInterface.
|
575 |
|
|
576 |
| Methods defined here:
|
577 |
|
|
578 |
| __init__(self, schema, cParms={})
|
579 |
| Constructor for the Table class
|
580 |
|
|
581 |
| delete(self, conditions)
|
582 |
| Delete function not implemented.
|
583 |
|
|
584 |
| getConnection(self)
|
585 |
| Returns the connection object.
|
586 |
| Implements TableInterface::getConnections
|
587 |
|
|
588 |
| initializeSequencers(self)
|
589 |
| This function initializes sequencers by appealing to the database table.
|
590 |
| The initial value is set to the max() of the corresponding column.
|
591 |
| Implements TableInterface::initializeSequencers().
|
592 |
|
|
593 |
| insert(self, row, colList=[])
|
594 |
| Does an insert on component tables. At least
|
595 |
| one unique key per comp table is required for insert.
|
596 |
| (There should be a test insert function.)
|
597 |
|
|
598 |
| resetConnection(self, **cParms)
|
599 |
| This closes the existing connection and opens a new one using the
|
600 |
| given parameters. If none are given, then existing parameters are used.
|
601 |
| Implements TableInterface::resetConnection.
|
602 |
|
|
603 |
| resetTransaction(self)
|
604 |
| This clears the transaction with implicit rollback.
|
605 |
| Implements TableInterface::resetTransaction
|
606 |
|
|
607 |
| saveTransaction(self)
|
608 |
| This clears the transaction with implicit commit.
|
609 |
| Implements TableInterface::saveTransaction
|
610 |
|
|
611 |
| schema(self)
|
612 |
| This returns a reference to the schema on which this table is defined.
|
613 |
| Implements TableInterface::schema()
|
614 |
|
|
615 |
| select(self, colList, conditions)
|
616 |
| Does a multi table select. colList should be in
|
617 |
| TableName.AttributeName format. What gets returned
|
618 |
| is more or less just a flat row, and the attributes
|
619 |
| in the column list and conditions are flattened as
|
620 |
| well.
|
621 |
|
|
622 |
| smartInsert(self, row, colList=[])
|
623 |
| Does a smartInsert on the multi tables.
|
624 |
|
|
625 |
| smartSelect(self, colList, conditions)
|
626 |
| Does a multi-table select that completely retrieves
|
627 |
| the objects.
|
628 |
|
|
629 |
| update(self, colList, values, conditions)
|
630 |
| Update function not implemented.
|
631 |
|
|
632 |
| ----------------------------------------------------------------------
|
633 |
| Data and other attributes defined here:
|
634 |
|
|
635 |
| SingleTable = <class ViewObjectLayer.SingleTable at 0x50c8d0>
|
636 |
| This class represents a single database table using the
|
637 |
| same interface as Table. This is meant for internal use
|
638 |
| only and is just an implementation mechanism.
|
639 |
|
|
640 |
| ----------------------------------------------------------------------
|
641 |
| Methods inherited from TableInterface:
|
642 |
|
|
643 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='modify'
|
644 |
| Abstract definition for interface method modify()
|
645 |
|
|
646 |
| ----------------------------------------------------------------------
|
647 |
| Data and other attributes inherited from TableInterface:
|
648 |
|
|
649 |
| expr = r"saveTransaction.__doc__ = '\n Abstract definition for inter...
|
650 |
|
|
651 |
| method = 'saveTransaction'
|
652 |
|
653 |
class TableInterface
|
654 |
| This interface is a light interface to a database table. It contains simple
|
655 |
| commit and rollback methods, a Row class definition and a factory method for
|
656 |
| making new Rows, sequencers for tables with artificial integer primary keys,
|
657 |
| and simple SQL manipulation methods insert, update, delete, select, and modify.
|
658 |
|
|
659 |
| Methods defined here:
|
660 |
|
|
661 |
| __init__(self, schema, cParms=None)
|
662 |
| Constructor - Abstract class definition
|
663 |
| Checks that methods declared in the public
|
664 |
| interface are actually defined.
|
665 |
|
|
666 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='delete'
|
667 |
| Abstract definition for interface method delete()
|
668 |
|
|
669 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='getConnection'
|
670 |
| Abstract definition for interface method getConnection()
|
671 |
|
|
672 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='initializeSequencers'
|
673 |
| Abstract definition for interface method initializeSequencers()
|
674 |
|
|
675 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='insert'
|
676 |
| Abstract definition for interface method insert()
|
677 |
|
|
678 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='modify'
|
679 |
| Abstract definition for interface method modify()
|
680 |
|
|
681 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='resetConnection'
|
682 |
| Abstract definition for interface method resetConnection()
|
683 |
|
|
684 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='resetTransaction'
|
685 |
| Abstract definition for interface method resetTransaction()
|
686 |
|
|
687 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='saveTransaction'
|
688 |
| Abstract definition for interface method saveTransaction()
|
689 |
|
|
690 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='schema'
|
691 |
| Abstract definition for interface method schema()
|
692 |
|
|
693 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='select'
|
694 |
| Abstract definition for interface method select()
|
695 |
|
|
696 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='smartInsert'
|
697 |
| Abstract definition for interface method smartInsert()
|
698 |
|
|
699 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='smartSelect'
|
700 |
| Abstract definition for interface method smartSelect()
|
701 |
|
|
702 |
| lambdaself, x='ViewObjectLayer', y='TableInterface', z='update'
|
703 |
| Abstract definition for interface method update()
|
704 |
|
|
705 |
| ----------------------------------------------------------------------
|
706 |
| Data and other attributes defined here:
|
707 |
|
|
708 |
| expr = r"saveTransaction.__doc__ = '\n Abstract definition for inter...
|
709 |
|
|
710 |
| method = 'saveTransaction'
|
711 |
|
712 |
class ViewObjectLayerException(genException.genException)
|
713 |
| Exception class for SQL side of object layer.
|
714 |
|
|
715 |
| Method resolution order:
|
716 |
| ViewObjectLayerException
|
717 |
| genException.genException
|
718 |
| exceptions.Exception
|
719 |
|
|
720 |
| Methods defined here:
|
721 |
|
|
722 |
| __init__(self, msgText, **kwargs)
|
723 |
| Constructor
|
724 |
|
|
725 |
| ----------------------------------------------------------------------
|
726 |
| Methods inherited from genException.genException:
|
727 |
|
|
728 |
| __str__(self)
|
729 |
| Generate string representation of error.
|
730 |
|
|
731 |
| ----------------------------------------------------------------------
|
732 |
| Methods inherited from exceptions.Exception:
|
733 |
|
|
734 |
| __getitem__(...)
|
735 |
|
736 |
FUNCTIONS
|
737 |
raiseAbstractException(module, Class, method)
|
738 |
General purpose exception raiser for abstract exceptions.
|
739 |
This will raise the AbstractMethodException with the
|
740 |
call parameters.
|
741 |
|
742 |
DATA
|
743 |
__revision__ = '$Revision: 1.2 $'
|
744 |
__version__ = '$Id: ViewObjectLayer.py,v 1.8 2005/05/16 07:14:11 ggrah...
|
745 |
|
746 |
VERSION
|
747 |
$Id: ViewObjectLayer.txt,v 1.2 2005/05/16 08:57:31 ggraham Exp $
|
748 |
|