3 Star 6 Fork 1

laiyonghao / pysequoiadb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

硬件环境

一台使用 virtualbox 虚拟出来的安装了 Ubuntu Linux Server 64bit 14.04 LTS 的虚拟机,宿主机器为 Intel X64 架构的 MacBook Pro。

  • 虚拟机内存:2GB
  • 虚拟机硬盘:40GB

安装好之后在终端执行 uname -a 可见类似输出:

$ uname -a
Linux ubuntu 3.16.0-52-generic #71~14.04.1-Ubuntu SMP Fri Oct 23 17:24:53 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

软件环境

首先需要更新系统软件,依次执行以下命令:

$ sudo aptitude update
$ sudo aptitude upgrade

然后安装各个依赖的软件包,执行:

$ sudo aptitude install build-essential ccache scons libboost-all-dev python-setuptools python-pip python-dev git

安装这些包需要一点时间,请耐心等待,确保安装成功。

然后需要安装 cython,执行:

$ sudo pip install cython

签出代码

SequoiaDB

目前本驱动只支持 0.11 版本的 SequoiaDB,所以签出代码时需要签出较早的版本,以下是方法。

首先回到 HOME 目录,执行:

cd ~

然后执行:

$ git clone https://git.oschina.net/wangzhonnew/SequoiaDB.git

成功克隆到本地后执行:

cd SequoiaDB

然后执行:

$ git checkout 9c798f5436cdc69a210bb6c17a26622ae83f0d63

成功后执行:

$ git log

这时候,可以看到最上面的几行应该跟下面几行一样:

commit 9c798f5436cdc69a210bb6c17a26622ae83f0d63
Author: Tao Wang <taoewang@sequoiadb.com>
Date:   Sat Apr 11 14:20:15 2015 +0800

    Revision: 17223

至此,可以确定成功签出了特定版本的 SequoiaDB

pysequoiadb

首先回到 HOME 目录,执行:

cd ~

然后执行:

$ git clone https://git.oschina.net/gzlyh/pysequoiadb.git

成功后签出完成。

编译

SequoiaDB

依次执行:

cd ~/SequoiaDB
scons --all

不需要编译旧的 Python Driver。

pysequoiadb

首先进入代码目录:

cd ~/pysequoiadb

然后熟悉的编辑器打开 setup.py,把ROOT_PATH 的值改为 SequoiaDB 源代码所在的路径,一般是 /home/xxx/SequoiaDB。保存后退出

执行:

./build.sh

尝试编译一次。然后再执行:

python setup.py install

等待一段时间,成功后即编译、安装成功。

体验

先运行单机版本的 SequoiaDB,依次执行,

cd ~/SequoiaDB/bin
./sdbstart -p 11810 --force

等其运行成功,然后执行:

cd ~/pysequoiadb/sample
python query.py

可以看到运行结果:

query one record, using condition={'id': {'$et': 0}}
{u'Item': u'basketball', u'_id': ObjectId('56437fde52444d09b8fe6998'), u'id': 0}
query all records:
{u'Item': u'basketball', u'_id': ObjectId('56437fde52444d09b8fe6998'), u'id': 0}
{u'sport id': 2, u'_id': ObjectId('56437fde52444d09b8fe6999')}
{u'sport id': 3, u'_id': ObjectId('56437fde52444d09b8fe699a')}
{u'sport id': 4, u'_id': ObjectId('56437fde52444d09b8fe699b')}
{u'sport id': 5, u'_id': ObjectId('56437fde52444d09b8fe699c')}
{u'sport id': 6, u'_id': ObjectId('56437fde52444d09b8fe699d')}
{u'sport id': 7, u'_id': ObjectId('56437fde52444d09b8fe699e')}
{u'sport id': 8, u'_id': ObjectId('56437fde52444d09b8fe699f')}
{u'sport id': 9, u'_id': ObjectId('56437fde52444d09b8fe69a0')}

至此,体验完成。

The MIT License (MIT) Copyright (c) 2015 laiyonghao Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

SequoiaDB 巨衫数据库的 Python 开发包 展开 收起
Python 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Python
1
https://gitee.com/gzlyh/pysequoiadb.git
git@gitee.com:gzlyh/pysequoiadb.git
gzlyh
pysequoiadb
pysequoiadb
master

搜索帮助