You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
Question: does python-rocksdb support importing external SST files, eg for bulk loads? #99
Options options;
SstFileWriter sst_file_writer(EnvOptions(), options, options.comparator);
Status s = sst_file_writer.Open(file_path);
assert(s.ok());
// Insert rows into the SST file, note that inserted keys must be
// strictly increasing (based on options.comparator)
for (...) {
s = sst_file_writer.Add(key, value);
assert(s.ok());
}
// Ingest the external SST file into the DB
s = db_->IngestExternalFile({"/home/usr/file1.sst"}, IngestExternalFileOptions());
assert(s.ok());
The post refers to the C++ Rocksdb API, eg db_->IngestExternalFile().
Does python-rocksdb support this kind of "ingest external SST files" (eg db_->IngestExternalFile()) behavior? I didn't see this function listed in python-rocksdb. Thanks!
@iFA88 Do you happen to know what it would take to get "import external SST files" with "perform reads on my Rocksdb table from python"?
One idea is: I could separately run the C++ Rocksdb code to do the "import external SST files" stuff to /path/to/my_db.db, and then load this RocksDb from python-rocksdb.
Given that python-rocksdb's rocksdb.DB(db_name, opts, read_only=read_only) is a thin wrapper around rocksdb::DB::Open(), I'm ~90% sure that the following pipeline will work for ingesting externally-generated SST files into python-rocksdb:
(1) Generate external SST files, eg from a big-data pipeline like Spark/MapReduce
(2) Ingest external SST files. On my dev machine, run a simple C++ program that calls
db_->IngestExternalFile() + manual compaction to ingest the external SST files into
a rocksdb "/path/to/my_db.db"
(3) Load Rocksdb from python-rocksdb. On my dev machine, create a Rocksdb handle
to my new DB by doing `rocksdb.DB("/path/to/my_db.db", opts)`
How did it go? And how do you generate the SST from your data pipeline?
Would be really cool to have a Python way of generating and ingesting SST files.
Activity
iFA88 commentedon Sep 22, 2021
Hey, thats not supported.
erickim555 commentedon Sep 22, 2021
@iFA88 Do you happen to know what it would take to get "import external SST files" with "perform reads on my Rocksdb table from python"?
One idea is: I could separately run the C++ Rocksdb code to do the "import external SST files" stuff to
/path/to/my_db.db, and then load this RocksDb frompython-rocksdb.Do you happen to know if this would work?
erickim555 commentedon Sep 22, 2021
Given that python-rocksdb's
rocksdb.DB(db_name, opts, read_only=read_only)is a thin wrapper aroundrocksdb::DB::Open(), I'm ~90% sure that the following pipeline will work for ingesting externally-generated SST files intopython-rocksdb:https://github.com/twmht/python-rocksdb/blob/master/rocksdb/_rocksdb.pyx#L1630
python-rocksdb/rocksdb/db.pxd
Line 162 in 3a5df05
python-rocksdb/rocksdb/db.pxd
Line 167 in 3a5df05
I'll give it a try and see how it goes
bartnaaijkens commentedon Oct 22, 2021
How did it go? And how do you generate the SST from your data pipeline?
Would be really cool to have a Python way of generating and ingesting SST files.
Congyuwang commentedon Jan 2, 2022
This library has SstFileWriter and ingestExternalFile implemented: https://github.com/Congyuwang/RocksDict.
pip install rocksdict. With pre-build wheels, no need to compile.Build Write Demo:
yihuang commentedon Dec 15, 2022
FYI, you should use the
Options(raw_mode=True)with rocksdict so the db don't created with a custom comparator.Congyuwang commentedon Dec 15, 2022
Yeah, that's right. Let me fix it.