Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(0)  |  Derive(0)  |  Import(4)

src/l/a/lai-client-HEAD/lai/db/mongo.py   lai-client(Download)
from pymongo.errors import AutoReconnect
from lai.db.base import DBBase
from lai.database import UPDATE_PROCESS, COMMIT_PROCESS
from lai.database import DatabaseException, NotFoundError
from lai import Document
            doc.synced = False
            set = doc
        elif process == UPDATE_PROCESS:
            if self.db.docs.find({'sid': doc.sid}).count() == 0:
                return self.insert(doc, synced=True)

src/l/a/lai-client-HEAD/lai/db/sqlite.py   lai-client(Download)
 
from lai.db.base import DBBase
from lai.database import UPDATE_PROCESS, COMMIT_PROCESS
from lai.database import DatabaseException, NotFoundError
from lai import Document
            args = (data, doc.user, int(doc.public), int(doc.synced), doc.id)
 
        elif process == UPDATE_PROCESS:
            self.cursor.execute("SELECT id FROM docs WHERE sid=?", (doc.sid,))
            if self.cursor.fetchone() is None:

src/l/a/lai-client-HEAD/lai/db/mysql.py   lai-client(Download)
 
from lai.db.base import DBBase
from lai.database import UPDATE_PROCESS, COMMIT_PROCESS
from lai.database import DatabaseException, NotFoundError
from lai import Document
            args = (data, doc.user, int(doc.public), int(doc.synced), doc.id)
 
        elif process == UPDATE_PROCESS:
            self.cursor.execute("SELECT id FROM lai_docs WHERE sid=%s",
                                doc.sid)

src/l/a/lai-client-HEAD/lai/client.py   lai-client(Download)
from lai import config
from lai.document import Document
from lai.database import UPDATE_PROCESS, COMMIT_PROCESS
from lai.database import NotFoundError
from lai.lib import crypto
    def update(self, docs=None):
        if docs is None:
            request = self._get_request_base_doc()
            request['process'] = UPDATE_PROCESS
            response = self._send(request)
        if docs_inspected['conflict_detected']:
            return docs_inspected
        ids = self._update(docs, UPDATE_PROCESS)
        self.db.save_last_sync(ids, UPDATE_PROCESS)