Integrate AlchemyBackend.
authorAntony Chazapis <chazapis@gmail.com>
Tue, 6 Sep 2011 11:52:46 +0000 (14:52 +0300)
committerAntony Chazapis <chazapis@gmail.com>
Tue, 6 Sep 2011 11:52:46 +0000 (14:52 +0300)
docs/source/adminguide.rst
pithos/backends/__init__.py
pithos/backends/lib_alchemy/node.py
pithos/backends/lib_alchemy/permissions.py
pithos/backends/modular_alchemy.py

index 4a1a068..aa99ca3 100644 (file)
@@ -9,6 +9,7 @@ Assuming a clean debian squeeze (stable) installation, use the following steps t
 Install packages::
 
   apt-get install git python-django python-setuptools python-sphinx
+  apt-get install python-sqlalchemy python-psycopg2
   apt-get install apache2 libapache2-mod-wsgi
 
 Get the source::
index 2b14dd3..56a0c36 100644 (file)
@@ -35,6 +35,7 @@ from django.conf import settings
 
 from simple import SimpleBackend
 from modular import ModularBackend
+from modular_alchemy import AlchemyBackend
 
 backend = None
 options = getattr(settings, 'BACKEND', None)
index 41f2ab9..7f8bbaa 100644 (file)
@@ -35,7 +35,6 @@ from time import time
 from sqlalchemy import Table, Integer, Float, Column, String, MetaData, ForeignKey
 from sqlalchemy.schema import Index, Sequence
 from sqlalchemy.sql import func, and_, or_, null, select, bindparam
-from duplicate import insertOnDuplicate
 from dbworker import DBWorker
 
 ROOTNODE  = 0
@@ -642,9 +641,9 @@ class Node(DBWorker):
     
     def attribute_copy(self, source, dest):
         from sqlalchemy.ext.compiler import compiles
-        from sqlalchemy.sql.expression import UpdateBase
+        from sqlalchemy.sql.expression import _UpdateBase
                 
-        class InsertFromSelect(UpdateBase):
+        class InsertFromSelect(_UpdateBase):
             def __init__(self, table, select):
                 self.table = table
                 self.select = select
index 3cdab40..42c0e4b 100644 (file)
@@ -32,7 +32,7 @@
 # or implied, of GRNET S.A.
 
 from sqlalchemy.sql import select, literal
-from sqlalchemy.sql.expression import join
+from sqlalchemy.sql.expression import join, union
 
 from xfeatures import XFeatures
 from groups import Groups
@@ -146,4 +146,4 @@ class Permissions(XFeatures, Groups, Public):
         r = self.conn.execute(s)
         l = [row[0] for row in r.fetchall()]
         r.close()
-        return l
\ No newline at end of file
+        return l
index a839672..954715b 100644 (file)
@@ -72,8 +72,8 @@ def backend_method(func=None, autocommit=1):
     return fn
 
 
-class ModularBackend(BaseBackend):
-    """A modular backend.
+class AlchemyBackend(BaseBackend):
+    """A backend based on ModularBackend that uses SQLAlchemy.
     
     Uses modules for SQL functions and storage.
     """