Home | Trees | Index | Help |
|
---|
Package pydo :: Module base :: Class PyDO |
|
object
--+ |dict
--+ | PyDO
Method Summary | |
---|---|
__setitem__(self,
k,
v)
| |
not implemented for PyDO classes | |
Commit changes to database (Class method) | |
returns a copy of self | |
remove the row that represents me in the database | |
delete possibly many records at once, and return the number deleted (Class method) | |
returns a copy of self as a plain dict | |
Returns a list of all columns in this table, in no particular order. (Class method) | |
Retrieve the number of object of this particular class, optionally limited by query arguments. (Class method) | |
return the database interface (Class method) | |
returns the effective fields of the class (Class method) | |
returns the effective sequences for the class (Class method) | |
Retrieve some objects of this particular class. (Class method) | |
returns the name of the table, qualified with the schema, if any, if withSchema is true. (Class method) | |
Retrieve one particular instance of this class. (Class method) | |
returns the effective uniqueness constraints of the class (Class method) | |
Handles many to many relations. | |
create and return a new data class instance using the values in fieldData. (Class method) | |
like new(), but always refetches. (Class method) | |
like new(), but never refetches. (Class method) | |
a hook for subclasses to modify/validate updates; by default returns the original data unchanged. | |
not implemented for PyDO classes | |
not implemented for PyDO classes | |
project(cls,
*fields,
**kwargs)
(Class method) | |
refetch myself from the database | |
Rollback current transaction (Class method) | |
not implemented for PyDO classes | |
Part of dictionary interface for field access | |
update possibly many records at once, and return the number updated (Class method) | |
returns the beginning of a select statement for this object's table. (Class method) | |
controls how fields are created when declared in the field list with a simple string, list, tuple, or dictionary rather than a field instance. (Static method) | |
Supplies the table fields (as a dict of fieldnames to Field objects) and a list of multi-column unique constraints to the metaclass, which will call it when guessing columns. (Class method) | |
SQL generating function for joinTable | |
return a tuple of column names that will uniquely identify a row given the choices from kw (Class method) | |
_new(cls,
fieldData,
refetch)
(Class method) | |
_processWhere(conn,
args,
fieldData,
converter)
(Static method) | |
_sequence_for(cls,
field)
(Class method) | |
given a connection and kw, using _matchUnique, generate a where clause to select a unique row. (Class method) | |
update self in database with the values in adict | |
a simple field validator that verifies that the keys in the dictionary passed are declared fields in the class. (Class method) | |
Inherited from dict | |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature | |
x.__cmp__(y) <==> cmp(x,y) | |
D.__contains__(k) -> True if D has a key k, else False | |
x.__delitem__(y) <==> del x[y] | |
x.__eq__(y) <==> x==y | |
x.__ge__(y) <==> x>=y | |
x.__getattribute__('name') <==> x.name | |
x.__getitem__(y) <==> x[y] | |
x.__gt__(y) <==> x>y | |
x.__hash__() <==> hash(x) | |
x.__iter__() <==> iter(x) | |
x.__le__(y) <==> x<=y | |
x.__len__() <==> len(x) | |
x.__lt__(y) <==> x<y | |
x.__ne__(y) <==> x!=y | |
x.__repr__() <==> repr(x) | |
D.get(k[,d]) -> D[k] if k in D, else d. | |
D.has_key(k) -> True if D has a key k, else False | |
D.items() -> list of D's (key, value) pairs, as 2-tuples | |
D.iteritems() -> an iterator over the (key, value) items of D | |
D.iterkeys() -> an iterator over the keys of D | |
D.itervalues() -> an iterator over the values of D | |
D.keys() -> list of D's keys | |
D.values() -> list of D's values | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
v defaults to None. |
Class Variable Summary | |
---|---|
NoneType |
connectionAlias = None |
bool |
guess_columns = False
|
bool |
guess_tablename = True
|
NoneType |
guesscache = None |
bool |
mutable = True
|
bool |
refetch = False
|
NoneType |
schema = None |
NoneType |
sequence_mapper = None |
str |
table = 'pydo'
|
bool |
use_attributes = True
|
type |
__metaclass__ = pydo.base._metapydo |
dict |
_fields = {}
|
bool |
_ignore_update_rowcount = False
|
bool |
_is_projection = False
|
dict |
_projections = {}
|
dict |
_sequenced = {}
|
frozenset |
_unique = frozenset([])
|
Instance Method Details |
---|
clear(self)not implemented for PyDO classes
|
copy(self)returns a copy of self
|
delete(self)remove the row that represents me in the database |
dict(self)returns a copy of self as a plain dict |
joinTable(self, thisAttrNames, pivotTable, thisSideColumns, thatSideColumns, thatObject, thatAttrNames, *whereArgs, **extra)Handles many to many relations. In short, do: SELECT thatObject.getColumns(1) FROM thatObject.table, pivotTable WHERE pivotTable.thisSideColumn = self.myAttrName AND pivotTable.thatSideColumn = thatObject.table.thatAttrName and return a list of thatObjects representing the resulting rows. The parameters which accept column names (thisAttrNames, thisSideColumns, thatSideColumns, thatAttrNames) can be strings (silently turned to tuples of length 1) or tuples of strings. For each pair P of the two pairs (thisSideColumns, thisAttrNames) and (thatSideColumns, thatAttrNames) len(P[0]) must equal len(P[1]). In addition, you can add extra tables and arbitrary sql to the where clause, as you can with getSome(), including order, limit and offset, using the "extraTables", "order", "limit" and "offset" keyword arguments, using SQLOperators or (sql-string, bind values) as positional arguments, and by specifying columns by keyword argument. |
onUpdate(self, adict)a hook for subclasses to modify/validate updates; by default returns the original data unchanged. |
pop(self)not implemented for PyDO classes
|
popitem(self)not implemented for PyDO classes
|
refresh(self)refetch myself from the database |
setdefault(self, key, val)not implemented for PyDO classes
|
update(self, adict)Part of dictionary interface for field access
|
_joinTableSQL(self, conn, thisAttrNames, pivotTable, thisSideColumns, thatSideColumns, thatObject, thatAttrNames, extraTables, wheresql, converter, order, limit, offset)SQL generating function for joinTable |
_update_raw(self, adict)update self in database with the values in adict |
Static Method Details |
---|
_create_field(*args, **kwargs)controls how fields are created when declared in the field list with a simple string, list, tuple, or dictionary rather than a field instance. By default, passes field declaration to the Field constructor. |
Class Method Details |
---|
commit(cls)Commit changes to database |
deleteSome(cls, *args, **fieldData)delete possibly many records at once, and return the number deleted |
getColumns(cls, qualifier=None)Returns a list of all columns in this table, in no particular order. If qualifier is true, returns fully qualified column names (i.e., table.column). If you pass in a string to qualifier, it will be used as a table alias; otherwise the table name will be used. |
getCount(cls, *args, **fieldData)Retrieve the number of object of this particular class, optionally limited by query arguments. |
getDBI(cls)return the database interface |
getFields(cls)returns the effective fields of the class |
getSequences(cls)returns the effective sequences for the class |
getSome(cls, *args, **fieldData)Retrieve some objects of this particular class. [todo: examples of use of operators, column-name keyword args, order, limit, and offset.] If you use SQL directly and pass variables, it is up to you to use the same paramstyle as the underlying driver. |
getTable(cls, withSchema=True)returns the name of the table, qualified with the schema, if any, if withSchema is true. |
getUnique(cls, **fieldData)Retrieve one particular instance of this class. Given the attribute/value pairs in fieldData, retrieve a unique row and return a data class instance representing said row or None if no row was retrieved. |
getUniquenessConstraints(cls)returns the effective uniqueness constraints of the class |
new(cls, **fieldData)create and return a new data class instance using the values in fieldData. This will also effect an INSERT into the database. If the keyword argument refetch is passed and is true, or, if it is not and cls.refetch is true, effectively do a getUnique on cls. |
newfetch(cls, **fieldData)like new(), but always refetches. |
newnofetch(cls, **fieldData)like new(), but never refetches. |
rollback(cls)Rollback current transaction |
updateSome(cls, adict, *args, **fieldData)update possibly many records at once, and return the number updated |
_baseSelect(cls, qualified=False)returns the beginning of a select statement for this object's table. |
_getTableDescription(cls)Supplies the table fields (as a dict of fieldnames to Field objects) and a list of multi-column unique constraints to the metaclass, which will call it when guessing columns. If cls.guesscache is false, this delegates directly to the DBI driver's describeTable() method, and performs no caching; otherwise, cls.guesscache is presumed to be something compatible a pydo.GuessCache, and it will be consulted and populated. |
_matchUnique(cls, kw)return a tuple of column names that will uniquely identify a row given the choices from kw |
_uniqueWhere(cls, conn, kw, converter=None)given a connection and kw, using _matchUnique, generate a where clause to select a unique row. |
_validateFields(cls, adict)a simple field validator that verifies that the keys in the dictionary passed are declared fields in the class. |
Class Variable Details |
---|
connectionAlias
|
guess_columns
|
guess_tablename
|
guesscache
|
mutable
|
refetch
|
schema
|
sequence_mapper
|
table
|
use_attributes
|
_fields
|
_ignore_update_rowcount
|
_is_projection
|
_projections
|
_sequenced
|
_unique
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Wed Mar 8 10:18:58 2006 | http://epydoc.sf.net |