Git Product home page Git Product logo

traildb-python's Introduction

Gitter Travis CI Coverage Status

TrailDB

TrailDB is an efficient tool for storing and querying series of events. This repository contains the core C library and the tdb command line tool.

Learn more at traildb.io.

Quick start

For detailed installation instructions, see Getting Started guide.

Installing binaries

On OSX, TrailDB is available through homebrew:

$ brew install traildb

Linux binaries are not available yet.

Compiling and installing from source

Install Dependencies

$ apt-get install libarchive-dev libjudy-dev pkg-config

For RPM-based distros:

$ yum install judy-devel libarchive-devel pkg-config

For OSX:

$ brew install traildb/judy/judy libarchive pkg-config

For FreeBSD:

$ sudo pkg install python libarchive Judy pkgconf gcc

Note that your systems package manager may have too old of libjudy. You may also require a patch if you are using gcc 4.9.

Build TrailDB

$ ./waf configure
$ ./waf install

Alternatively you may use autotools

$ ./autogen.sh
$ ./configure
$ make
$ make install

Run Tests

$ ./waf test

traildb-python's People

Contributors

c3h3 avatar gregn-adroll avatar gregory-nisbet avatar joeyrobert avatar kayibal avatar knutin avatar noeda avatar rnowling-adroll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

traildb-python's Issues

Docker container is broken

In the terminal:

docker run -p 8080:8888 -it c3h3/traildb-ipynb

Immediately after, in the first notebook in the browser:

In [1]:
from traildb import TrailDB
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-5a527c6b20d5> in <module>()
----> 1 from traildb import TrailDB

/root/.pyenv/versions/anaconda-2.3.0/lib/python2.7/site-packages/traildb/__init__.py in <module>()
----> 1 from .traildb import TrailDBError, TrailDBConstructor, TrailDB, TrailDBCursor, TrailDBEventFilter, tdb_item_field, tdb_item_val

/root/.pyenv/versions/anaconda-2.3.0/lib/python2.7/site-packages/traildb/traildb.py in <module>()
     90 api(lib.tdb_event_filter_new, [], tdb_event_filter)
     91 api(lib.tdb_event_filter_add_term, [tdb_event_filter, tdb_item, c_int], tdb_error)
---> 92 api(lib.tdb_event_filter_add_time_range, [c_uint64, c_uint64], tdb_error)
     93 api(lib.tdb_event_filter_new_clause, [tdb_event_filter], tdb_error)
     94 api(lib.tdb_event_filter_new_match_none, [], tdb_event_filter)

/root/.pyenv/versions/anaconda-2.3.0/lib/python2.7/ctypes/__init__.pyc in __getattr__(self, name)
    376         if name.startswith('__') and name.endswith('__'):
    377             raise AttributeError(name)
--> 378         func = self.__getitem__(name)
    379         setattr(self, name, func)
    380         return func

/root/.pyenv/versions/anaconda-2.3.0/lib/python2.7/ctypes/__init__.pyc in __getitem__(self, name_or_ordinal)
    381 
    382     def __getitem__(self, name_or_ordinal):
--> 383         func = self._FuncPtr((name_or_ordinal, self))
    384         if not isinstance(name_or_ordinal, (int, long)):
    385             func.__name__ = name_or_ordinal

AttributeError: /usr/local/lib/libtraildb.so: undefined symbol: tdb_event_filter_add_time_range

Use CFFI instead of ctypes

CFFI will allow us to use traildb with PyPy, leading to better performancce of the program in general.
Moreover, CFFI is faster even on CPython and it releases the GIL which allows for true parallelism as one might expect from a C library that performs I/O.
The only thing that is faster than CFFI on CPython is a C extension. We can provide both or keep the CFFI version only.

Python3 not supported

$ python setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/traildb
copying traildb/init.py -> build/lib/traildb
copying traildb/main.py -> build/lib/traildb
copying traildb/traildb.py -> build/lib/traildb
running install_lib
copying build/lib/traildb/init.py -> /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb
copying build/lib/traildb/main.py -> /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb
copying build/lib/traildb/traildb.py -> /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb
byte-compiling /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb/init.py to init.cpython-35.pyc
byte-compiling /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb/main.py to main.cpython-35.pyc
File "/Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb/main.py", line 5
print cookie, trail
^
SyntaxError: Missing parentheses in call to 'print'

byte-compiling /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb/traildb.py to traildb.cpython-35.pyc
File "/Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb/traildb.py", line 109
def tdb_item_val32(item): return (item >> 8) & 4294967295L # UINT32_MAX
^
SyntaxError: invalid syntax

running install_egg_info
Removing /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb-0.0.1-py3.5.egg-info
Writing /Users/jobonilla/anaconda/lib/python3.5/site-packages/traildb-0.0.1-py3.5.egg-info


Works if I install with python2.
Using Mac OS

TrailDBConstructor crashes if the first field is called username

I don't know why but it seems to me that TrailDBConstructor crashes if the first fieldname is username:

Python 2.7.13 (default, May 2 2017, 15:58:16)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from traildb import TrailDBConstructor, TrailDB
cons = TrailDBConstructor('foobar', ['username'])
[1] 88728 abort python

I noticed it because I was going through the tutorial and the first example didn't work http://traildb.io/docs/tutorial/#part-i-create-a-simple-traildb

I noticed that it doesn't happen if the field called "username" is not the first item in the array:

from traildb import TrailDBConstructor
TrailDBConstructor('foobar', ['alice', 'username'])
<traildb.traildb.TrailDBConstructor object at 0x10f609450>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.