Revision 3d13f97a pithos/backends/lib/sqlalchemy/node.py
b/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
35 | 35 |
from sqlalchemy import Table, Integer, BigInteger, DECIMAL, Column, String, MetaData, ForeignKey |
36 | 36 |
from sqlalchemy.types import Text |
37 | 37 |
from sqlalchemy.schema import Index, Sequence |
38 |
from sqlalchemy.sql import func, and_, or_, null, select, bindparam, text |
|
38 |
from sqlalchemy.sql import func, and_, or_, not_, null, select, bindparam, text
|
|
39 | 39 |
from sqlalchemy.ext.compiler import compiles |
40 | 40 |
from sqlalchemy.engine.reflection import Inspector |
41 | 41 |
|
42 | 42 |
from dbworker import DBWorker |
43 | 43 |
|
44 |
from pithos.lib.filter import parse_filters |
|
45 |
|
|
44 | 46 |
ROOTNODE = 0 |
45 | 47 |
|
46 | 48 |
( SERIAL, NODE, HASH, SIZE, SOURCE, MTIME, MUSER, CLUSTER ) = range(8) |
... | ... | |
82 | 84 |
s += unichr(c-1) + unichr(0xffff) |
83 | 85 |
return s |
84 | 86 |
|
85 |
|
|
86 | 87 |
_propnames = { |
87 | 88 |
'serial' : 0, |
88 | 89 |
'node' : 1, |
... | ... | |
752 | 753 |
|
753 | 754 |
def latest_version_list(self, parent, prefix='', delimiter=None, |
754 | 755 |
start='', limit=10000, before=inf, |
755 |
except_cluster=0, pathq=[], filterq=None):
|
|
756 |
except_cluster=0, pathq=[], filterq=[]):
|
|
756 | 757 |
"""Return a (list of (path, serial) tuples, list of common prefixes) |
757 | 758 |
for the current versions of the paths with the given parent, |
758 | 759 |
matching the following criteria. |
... | ... | |
827 | 828 |
s = s.where(or_(*conj)) |
828 | 829 |
|
829 | 830 |
if filterq: |
830 |
s = s.where(a.c.key.in_(filterq.split(','))) |
|
831 |
included, excluded, opers = parse_filters(filterq) |
|
832 |
if included: |
|
833 |
s = s.where(a.c.key.in_(x for x in included)) |
|
834 |
if excluded: |
|
835 |
s = s.where(not_(a.c.key.in_(x for x in excluded))) |
|
836 |
if opers: |
|
837 |
for k, o, v in opers: |
|
838 |
s = s.where(or_(a.c.key == k and a.c.value.op(o)(v))) |
|
831 | 839 |
|
832 | 840 |
s = s.order_by(n.c.path) |
833 | 841 |
|
Also available in: Unified diff