Giter VIP home page Giter VIP logo

ejdb-python's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ejdb-python's Issues

Regexp string matching seems not to work

The ejdb states that it's possible to use regexp for string matching, using the syntax described in http://ejdb.org/doc/ql/ql.html#simple-matching

I'm trying to achieve this using the python bindings, expecting to match the "Grenny" parrot.

>>> with ejdb.find('parrots2', {"name": "/G.*/"}) as cur:
...     print("found %s parrots" % len(cur))
... 
found 0 parrots

I wonder if I'm doing anything wrong, or if the regexp matching is really supported by the python bindings ?

EJDB_update

Hi,
It seems that there is no EJDB_update in python binding, are u planning to implement this?

cheers,

Compile with -Wno-declaration-after-statement flag

python setup.py install is failing due to my compiler (gcc 4.9.1 on Arch Linux) automaticly adding the flag -Werror=declaration-after-statement.
I managed to install the package adding "-Wno-declaration-after-statement" in the extra_compile_args of ejdb_ext in the setup.py file.

Cannot read data after reopen DB

Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyejdb
>>> from datetime import datetime
>>> 
>>> #Open database
... ejdb = pyejdb.EJDB("zoo", pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC)
>>> 
>>> parrot1 = {
...     "name": "Grenny",
...     "type": "African Grey",
...     "male": True,
...     "age": 1,
...     "birthdate": datetime.utcnow(),
...     "likes": ["green color", "night", "toys"],
...     "extra1": None
... }
>>> parrot2 = {
...     "name": "Bounty",
...     "type": "Cockatoo",
...     "male": False,
...     "age": 15,
...     "birthdate": datetime.utcnow(),
...     "likes": ["sugar cane"],
...     "extra1": None
... }
>>> ejdb.save("parrots2", parrot1, parrot2)
>>> 
>>> with ejdb.find("parrots2", {"likes" : "toys"},
...           hints={"$orderby" : [("name", 1)]}) as cur:
...     print("found %s parrots" % len(cur))
...     for p in cur:
...         print("%s likes toys!" % p["name"])
... 
found 1 parrots
Grenny likes toys!
>>> ejdb.close()
>>> 
==================================================================                                                                                                                                                                          
Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyejdb
>>> from datetime import datetime
>>> 
>>> #Open database
... ejdb = pyejdb.EJDB("zoo", pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC)
>>> with ejdb.find("parrots2", {"likes" : "toys"},
...           hints={"$orderby" : [("name", 1)]}) as cur:
...     print("found %s parrots" % len(cur))
...     for p in cur:
...         print("%s likes toys!" % p["name"])
... 
found 0 parrots

libejdb 1.2.10
pyejdb 1.0.16
Python 3.5
Archlinux

Data has been saved to the database file, but it can not be read.

Unable to install, Python > 2.7.10, OS X

Well, the problem is in the file setup.py, the version check is comparing strings:

if py_ver < min_py_vers[int(py_ver[0])]:
raise SystemExit("Aborted: EJDB requires Python >= {0}".format(min_py_vers[int(py_ver[0])]))

In my case, "2.7.10" < "2.7.2" returns True, so the check does not pass and the SystemExit is raised.

Unable to install, Python 2.7.6, OS X

building '_pyejdb' extension

creating build/temp.macosx-10.4-x86_64-2.7

creating build/temp.macosx-10.4-x86_64-2.7/src

/usr/local/bin/gcc-4.2 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/Loki/.pyenv/versions/2.7.6/include/python2.7 -c src/pyejdb.c -o build/temp.macosx-10.4-x86_64-2.7/src/pyejdb.o -std=c99 -Wall

/usr/local/bin/gcc-4.2 -bundle -undefined dynamic_lookup -L/usr/local/opt/readline/lib build/temp.macosx-10.4-x86_64-2.7/src/pyejdb.o -ltcejdb -lz -lpthread -lm -lc -lrt -o build/lib.macosx-10.4-x86_64-2.7/_pyejdb.so

ld: library not found for -lrt

collect2: ld returned 1 exit status

error: command '/usr/local/bin/gcc-4.2' failed with exit status 1

Cyrillic symbols issue

When I try to save some cyrillic text to my EJDB I get:

Traceback (most recent call last):
  File "test11.py", line 9, in <module>
    db.save('d', {'name': 'ПРОВЕРКА'})
  File "/usr/local/lib/python2.7/dist-packages/pyejdb/__init__.py", line 257, in save
    _oid = self.__ejdb.save(cname, bson.serialize_to_bytes(doc), **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pyejdb/bson.py", line 819, in serialize_to_bytes
    serialize_to_stream(document, stream)
  File "/usr/local/lib/python2.7/dist-packages/pyejdb/bson.py", line 824, in serialize_to_stream
    py_to_bs(document).serialize(stream)
  File "/usr/local/lib/python2.7/dist-packages/pyejdb/bson.py", line 363, in serialize
    v.serialize(e_list)
  File "/usr/local/lib/python2.7/dist-packages/pyejdb/bson.py", line 240, in serialize
    value_b = self._value.encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd1 in position 0: ordinal not in range(128)

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.