disqus / nydus

Nydus is a Python toolkit for managing database connections and routing operations, primarily for Redis
Apache License 2.0
380 stars 38 forks source link

KeyError: 'engine' When Creating Cluster #17

Closed nickpresta closed 12 years ago

nickpresta commented 12 years ago

Info

Python 2.7.3rc2   
>>> nydus.VERSION
'0.9.0'

I'm trying to use create_cluster to create a Redis cluster.

>>> r = create_cluster({
    #'engine': 'nydus.db.backends.redis.Redis',
    'backend': 'nydus.db.backends.redis.Redis',
    'hosts': {
        0: {}
    }
})
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/usr/local/lib/python2.7/dist-packages/nydus/db/base.py", line 45, in create_cluster
    if isinstance(settings['engine'], basestring):
KeyError: 'engine'

Using 'engine' works:

>>> r = create_cluster({
    'engine': 'nydus.db.backends.redis.Redis',
    #'backend': 'nydus.db.backends.redis.Redis',
    'hosts': {
        0: {}
    }
})
>>> r
<nydus.db.base.Cluster object at 0xb6fa736c>

It seems that in 0.9.0, you shouldn't need engine and should be using backend.

dcramer commented 12 years ago

@NickPresta this code no longer exists in master, and there will be a new release soon