Giter Club home page Giter Club logo

Comments (4)

coleifer avatar coleifer commented on June 3, 2024

It's worth noting that if, in the second example, you use different names for env and db (env2 and db2), the segfault doesn't happen. Something to do with the destructor I'm sure, just not quite clear on what's going on here.

from sophy.

coleifer avatar coleifer commented on June 3, 2024

Working on a rewrite which will fix this and also support the latest version 2.2. It's in a branch and I anticipate merging in the next day or so.

from sophy.

coleifer avatar coleifer commented on June 3, 2024

This is fixed in master. The latest changes are also deployed to PyPI as version 0.2.0.

To fully support Sophia's multi-field key and value schema, Sophy has a new API for instantiating environments. Here is the equivalent code in Sophy 0.2.0:

from sophy import *
env = Sophia('/tmp/sophy-gh-10')
schema = Schema(key_parts=[StringIndex('key')], value_parts=[StringIndex('val')])
db = env.add_database('foo', schema)

env.open()  # True
db['a'] = 'xxx'
db['b'] = 'yyy'
db['c'] = 'zzz'
env.close()  # True

env.open()  # True
for key, value in db:
    print key, value
# a xxx
# b yyy
# c zzz
env.close()

env = Sophia('/tmp/sophia-gh-10')
db = env.add_database('foo', schema)
env.open()  # True

for key, value in db:
    print key, value
# a xxx
# b yyy
# c zzz

env.close()  # True

from sophy.

lebedov avatar lebedov commented on June 3, 2024

Thanks!

from sophy.

Related Issues (15)

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.