Skip to main content

ffdb.py - Flat-File DB: nosql single file database and document storage

The module ffdb and the associated set of utility scripts (indexer, extractor, filestorer, remover and merger) allow the creation, maintenance and usage of a database and document storage which employs a single file acting as a container for all the data.

This file can be distributed in several copies, made locally available or placed online to be accessed remotely (e.g. over ftp or www).

The resulting database is hence accessible everywhere, without the need for any complex installation and in particular without requiring any service to be running continuously.

  • Simple 1-2-3 procedure:
  1. Index your flat-file and/or choose documents to store
  2. Place the resulting file wherever you want (locally or online, e.g. ftp or www)
  3. Retrieve the entries or the documents from any device and location

FFDB can index entries according to any pattern, creating index of identifiers unique to each entry or shared across many. For a biological database this could mean for example to allow retrieval of all entries belonging to a certain species.

When requesting entries, the user can specify whether retrieving all the entries corresponding to the given identifier, or only the first or only the last one. This allows the possibility of storing a version history of the entries, continuously appending new entry versions to the file.

When indexing entries of a flat-file or storing documents inside the database, the user can optionally specify to encrypt (AES) or compress (ZLIB) the entries/files.

Encrypted entries share a single master password but each has a unique IV (Initialization vector). No plaintext information is sent or received, thus allowing secure access to encrypted entries of the database over insecure channels.

With an external utility (gztool), the container file can even be compressed as a whole, while still allowing retrieval of single entries. This can be useful when said file needs to also be distributed and employed in its entirety, without limiting its use only via ffdb.

If the container file is compressed with bgzip, then no external utility is needed.

Documentation

Download and installation

ffdb is pure python code. It has no platform-specific dependencies and should thus work on all platforms. It requires the packages requests pycryptodomex and sortedcontainers. The latest version of ffdb can be installed by typing either:

pip3 install -U ffdb

(from Python Package Index)

or:

pip3 install git+git://github.com/g-insana/ffdb.py.git

(from GitHub).

The utility scripts should get installed for you by pip (if installed as --user you may need to add e.g. ~/.local/bin/ to your $PATH). Alternatively, you can directly download those you need:

curl -LO https://github.com/g-insana/ffdb.py/raw/master/scripts/indexer.py
curl -LO https://github.com/g-insana/ffdb.py/raw/master/scripts/extractor.py
curl -LO https://github.com/g-insana/ffdb.py/raw/master/scripts/remover.py
curl -LO https://github.com/g-insana/ffdb.py/raw/master/scripts/merger.py

Quickstart: some examples

 #index a flat-file:

$ indexer.py -i '^name: (.+)$' 'email: (.+)$' -f addressbook >addressbook.idx

$ indexer.py -i '^AC   (.+?);' -f uniprot.dat -e '^//$' >uniprot.pac

 #store all the files contained in a directory:

$ filestorer.py -f myphotos.db -d iceland_photos/

 #add some more files

$ filestorer.py -f myphotos.db -s sunset.jpg icecream.jpg

 #extract a series of entries from the db

$ extractor.py -f uniprot.dat -i uniprot.pac -l sars_proteins

 #extract an entry from remote location

$ extractor.py -f http://remote.host/addressbook -i addressbook.idx -s john@abc.de

 #extract a file from the db

$ extractor.py -f myphotos.db -s sunset.jpg >sunset.jpg

 #merge two indexed flat-files

$ merger.py -f mydb -i mydb.idx -e newentries -n newentries.idx -d #(mydb will incorporate newentries)

 #remove a series of entries from the db

$ remover.py -f addressbook -i addressbook.idx -l disagreed_with_me.list

ffdb is licensed under the GNU Affero General Public License.

(c) Copyright Giuseppe Insana, 2020-

Metadata

Release files for ffdb 2.5.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ffdb 2.5.7
File Size Uploaded Provenance Actions
ffdb-2.5.7.tar.gz 61.6 kB Without provenance Details for ffdb-2.5.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ffdb 2.5.7
File Interpreter ABI Platform Actions
ffdb-2.5.7-py3-none-any.whl Python 3 none any Details for ffdb-2.5.7-py3-none-any.whl

Total release size: 120.6 kB

Release files / ffdb-2.5.7.tar.gz

Download URL ffdb-2.5.7.tar.gz
Size 61.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d6ab1a19042b817183dd70f55925355723ae295d7daabada4a902ccb21ec8dd4
BLAKE2b-256 checksum
How to use checksums
516c26dd8716c71c8f9457d04cd2bfb23eed7a53ea15703db07d26550ca1a733
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.19

Release files / ffdb-2.5.7-py3-none-any.whl

Download URL ffdb-2.5.7-py3-none-any.whl
Size 59.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f4cfb59d0344392bd17e4b9bd9c4c2daf8bbe4536df865a6994a87a35fc0ffc
BLAKE2b-256 checksum
How to use checksums
8f81d22e412a2d4a54b2160e40412b70856277ddadbcc82c277d7cc3fa79c49e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.19

Security for ffdb 2.5.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page