twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
274 stars 89 forks source link

Know item exists, but db.get(item, cfname) returns None #69

Closed dnck closed 4 years ago

dnck commented 4 years ago

I am reading from a colleagues DB directory. I know his column family names, and I can successfully read the DB into Python.

db.column_families

returns the expected names of the column families.

Also, iterating over the list returned by,

db.get_live_files_metadata()

returns some expected keys for my SST files.

However, when I use one of these keys with,

db.get(key, cf_name)

the return value is None.

Any pointers / tips for what I might be doing wrong?

My end goal is to iterate over all of the keys and store them in a text file.

TomGoBravo commented 4 years ago

Looking at https://github.com/twmht/python-rocksdb/commit/2a66e20ca31b2fdef44cfb9d3bbadd43500a9d8e#diff-124ea9e14609cd0b2f9e432ea2e4f022R548 I'd try db.get((cf_name, key)).

dnck commented 4 years ago

Looking at 2a66e20#diff-124ea9e14609cd0b2f9e432ea2e4f022R548 I'd try db.get((cf_name, key)).

Ah I see, I had the order of arguments incorrect and I was missing the parentheses.

Thanks so much! It's working now.