| name, bases, attributes) |
The purpose of ptype is to register newly defined classes with the
database and to delegate object instantiation to the database. ptype
derives from the build in type.
The constructor performs bookkeeping operations on persistent properties, and registers the class with the database.
| *args, **kwargs) |
The following methods on ptype behave as if they are class-methods on
pobject (see below).
| ) |
| *args, **kwargs) |
args and kwargs to the
constructor
| oid) |
A persistent class should:
pobject
database, referring to a database interface
ptype (q.v.).
| ) |
First, recursively, commit all objects that the object refers to, then commit the object itself.
All persistent properties have the following attributes
__dict__. This value is set upon initialization of the class by the
metaclass.
val is type
checked using isinstance(val, ptype)
__dict__.
| default=None) |
| instance, cls=None) |
If called as instance.attr, return the value of the property. If called
as cls.attr, return a prel.value_attr object.
The following classed derive from pval:
| Property | ptype | default |
|---|---|---|
pint |
int |
0 |
pfloat |
float |
0.0 |
pstr |
str |
'' |
pdate |
datetime.date |
datetime.date(1,1,1) |
ptime |
datetime.time |
datetime.time() |
pdatetime |
datetime.datetime |
datetime.datetime(1,1,1) |
| cls, default=None) |
cls.
| instance, cls=None) |
If called as instance.attr, return the value of the property. If the value
is a tuple (cls, oid) then it first instantiates the object using
cls(oid=oid).
If called as cls.attr, return a prel.ref_attr object.
This module implements the relational algebra for PyORQ.
Ths module is used internally by PyORQ, You don't need this information to work with queries
A more or less formal definition is given by the following grammar:
relation := rel_not | rel_and | rel_or | comparions rel_not := '~' relation rel_and := relation '&' relation rel_or := relation '|' relation comparison := expr cmp_op expr cmp_op := '==' | '!=' | '<' | '<=' | '>' | '>>' expression := min_expr | bin_expr | term min_expr := '-' expr bin_expr := expr bin_op expr bin_op := '+' | '-' | '*' | '/' term := value_attr | ref_attr | int | long | float | str ...
All classes in this module define the following methods:
| ) |
| db) |
| ) |
| d) |
A.b.c.d == 3, produces a bound-variable
dict {('_x', 'b'): A.b.ptype, ('_x', 'b', 'c'): A.b.ptype.c.ptype} This
dictionary is used to produce aliases and join clauses.
The module defines the following classes
| ) |
| ) |
| ) |
The iterator loops over all subclasses of the free variable of the relation. The database evaluates the relation for each subclass
The following classes are derived from expression.
| parent, prop) |
This object is returned by the getter of property prop if the attribute
is accessed as a class attribute. In this case parent refers to the
class. The object may also be returned by ref_attr.__getattr__(attr) if
attr is as persistent value of the referred property. In this case
the parent will be the ref_attr object.
| parent, prop) |
This object is returned by the getter of property prop if the attribute
is accessed as a class attribute. In this case parent refers to the
class. The object may also be returned by ref_attr.__getattr__(attr) if
attr is as persistent reference of the referred property. In this case
the parent will be the ref_attr object.
| attr) |
If attr is a persistent value of the persistent class that ref_attr
refers to, return a new value_attr object. If it is a persistent ref,
return a ref_attr object. Otherwise, raise an AttributeError.
Comparisons of ref_attr objects with instances implies identity comparison.
| other) |
comp_is object.
| other) |
comp_not_is object.
| value) |
value of one of the built in Python
types.
| arg) |
-arg
| lhs, rhs) |
lhs + rhs
| lhs, rhs) |
lhs - rhs
| lhs, rhs) |
lhs * rhs
| lhs, rhs) |
lhs / rhs
The following classed are derived from relation.
| lhs, rhs) |
lhs == rhs
| lhs, rhs) |
lhs != rhs
| lhs, rhs) |
lhs >= rhs
| lhs, rhs) |
lhs > rhs
| lhs, rhs) |
lhs <= rhs
| lhs, rhs) |
lhs < rhs
| lhs, rhs) |
lhs == rhs if lhs or rhs is a ref_attr
| lhs, rhs) |
lhs != rhs if lhs or rhs is a ref_attr
| lhs, rhs) |
lhs & rhs
| lhs, rhs) |
lhs | rhs
| arg) |
~arg