Revision 12cd0417 pithos/backends/lib/sqlalchemy/node.py
b/pithos/backends/lib/sqlalchemy/node.py | ||
---|---|---|
37 | 37 |
from sqlalchemy.schema import Index, Sequence |
38 | 38 |
from sqlalchemy.sql import func, and_, or_, null, select, bindparam, text |
39 | 39 |
from sqlalchemy.ext.compiler import compiles |
40 |
#from sqlalchemy.dialects.mysql import VARBINARY |
|
41 | 40 |
from sqlalchemy.engine.reflection import Inspector |
42 | 41 |
|
43 | 42 |
from dbworker import DBWorker |
... | ... | |
185 | 184 |
insp = Inspector.from_engine(self.engine) |
186 | 185 |
indexes = [elem['name'] for elem in insp.get_indexes('nodes')] |
187 | 186 |
if 'idx_nodes_path' not in indexes: |
188 |
s = text('CREATE INDEX idx_nodes_path ON nodes (path(%s))' %path_length_in_bytes) |
|
187 |
explicit_length = '(%s)' %path_length_in_bytes if self.engine.name == 'mysql' else '' |
|
188 |
s = text('CREATE INDEX idx_nodes_path ON nodes (path%s)' %explicit_length) |
|
189 | 189 |
self.conn.execute(s).close() |
190 | 190 |
|
191 | 191 |
s = self.nodes.select().where(and_(self.nodes.c.node == ROOTNODE, |
... | ... | |
434 | 434 |
size of objects and mtime in the node's namespace. |
435 | 435 |
May be zero or positive or negative numbers. |
436 | 436 |
""" |
437 |
|
|
438 | 437 |
s = select([self.statistics.c.population, self.statistics.c.size], |
439 | 438 |
and_(self.statistics.c.node == node, |
440 | 439 |
self.statistics.c.cluster == cluster)) |
Also available in: Unified diff