pydbase(1)

NAME
pydbase - Simple python database

SYNOPSIS
pydbase [options] [key data]

DESCRIPTION
This manual page documents the pydbase python database

pydbase Features:
    o Simple usage, reliable storage
    o Per record checksum
    o Multi platform operation (Linux and Windows for now)
    o Fast. Because it is simple

COMMAND LINE OPTIONS
Usage: dbaseadm.py [options] [arg_key arg_data]
    -h Help (this screen)
    -E Replace record in place (see notes)
    -V Print version
    -q Quiet on, less printing
    -d Debug level (0-10)
    -v Increment verbosity level
    -r Randomize (with -w)
    -w Write random record(s)
    -z Dump backwards(s)
    -i Show deleted record(s)
    -U Vacuum DB
    -R Re-index / recover DB
    -I DB Integrity check
    -c Set check integrity flag
    -s Skip to count recs
    -K List keys only
    -S Print num recs
    -m Dump data to console
    -n num Num of recs (with -w)
    -t keyval Retrieve by key
    -o offs Get data from offset
    -G num Get record by number
    -F subkey Find by sub str
    -g num Get number of recs.
    -k keyval Key to save
    -a str Data to save
    -y keyval Find by key
    -D keyval Delete by key
    -p num Skip number of recs
    -u recnum Delete at recnum
    -l lim Limit get records
    -e offs Delete at offset
    -Z keyval Get record position
    -X max Limit recs on delete
    -f file DB file for save/retrieve default: 'pydbase.pydb' The verbosity / debug level influences the amount of printout presented. Use quotes for multi word arguments. Notes:
 For in-place replacement, the replacement record has to be shorter than the existing record. If longer, the record is stored as normal.

BLOCKCHAIN
 The database is extended with a blockhcain implementation. The new class is called twinchain; and it is a class derived from twincore.
 To drive the blockchain, use chainad.py append method. The database will calculate all the hashes, integrate it into the existing chain with the new item getting a back link field. This field is calculated based upon the previous record's hash and the previous record's frozen date. This assures that identical data will have a different hash, so data cannot be anticipated based upon its hash alone. The hash is done with 256 bits, and assumed to be very secure. Usage: chainadm.py [options]
    -a data append data to the end of chain
    -g recnum get record
    -k reckey get record by key/header
    -G recnum get record offset
    -r recnum get record header
    -n append / show / get number of records
    -e override header (checked for UUID)
    -t print record's UUID date)
    -s skip count
    -x max record count to list
    -m dump chain data
    -c check data integrity
    -i check link integrity
    -S get db size
    -v increase verbosity
    -h help (this screen)

FILESPEC
Saved file specification consists of two parts:

    o Data file
    o Index file

Structure of the data:
    DATA FILE HEADER
    FILESIG = b"PYDB"
    32 byte header, starting with FILESIG
    4 bytes 4 bytes 4 bytes Variable
    ------------------------------------------------------------
    RECSIG Hash_of_key Len_of_key DATA_for_key
    RECSEP Hash_of_payload Len_of_payload DATA_for_payload
        .
        .
    RECSIG Hash_of_key Len_of_key DATA_for_key
    RECSEP Hash_of_payload Len_of_payload DATA_for_payload
    where:
    RECSIG="RECB" (record begin here)
    RECSEP="RECS" (record separated here)
    RECDEL="RECX" (record deleted)
    Deleted records are marked with the RECSIG mutated from RECB to RECX
    Vacuum will remove the deleted records; Make sure your database has no
    pending ops; or non atomic opts when vacuuming; Structure of the index:
    INDEX FILE HEADER
    IDXSIG = b"PYIX"
    32 byte header, starting with IDXSIG
    32 bit index
    .
    .
    32 bit index ...
    The index is the offset of the record in the data file.

PLATFORMS
All platforms that have python should work fine. Current platforms include Linux, WinX, MSYS2 ...

FILES
 pydbase/*, dbaseadm.py chainadm.py twincore.py, chaincore.py twinbase.py
 dbutils.py

COPYING
pydbase can be copied under the MIT or General Public License

AUTHOR
pydbase was written by Peter Glen, peterglen99@google.com