We are pleased to introduce you the new development version of Relational pipes. This release brings the Bash completion scripts, improved SQL and AWK transformations and fixes the license version.
relpipe-in-filesystem
,
relpipe-in-xmltable
,
relpipe-tr-awk
,
relpipe-tr-guile
,
relpipe-tr-sql
,
relpipe-in-sql
.
relpipe-tr-sql
can now work also in the relpipe-in-sql
mode (symlink to the same binary),
so it can be used as an input filter for reading SQL scripts (instead of relational data) or as an SQLite client (options --file
and --file-keep
, see examples).
There are also new options --copy
and --copy-renamed
for copying particular (or all) relations from the input to the output.
Such relations are specified by a regular expression and can be renamed using regular expressions replacement string.
--where
option, which can be used in addition to the more generic --for-each
option.
The argument syntax now better expresses the intention (filtering records) and matches the syntax of the relpipe-tr-guile
tool.
n.b. the --file
and --file-keep
have been dropped in v0.16
(replacement is described in the v0.16 release notes).
See the examples and screenshots pages for details.
Please note that this is still a development release and thus the API (libraries, CLI arguments, formats) might and will change. Any suggestions, ideas and bug reports are welcome in our mail box.
Instalation was tested on Debian GNU/Linux 9.6. The process should be similar on other distributions.
# Install dependencies as root:
su -c "apt install g++ make cmake mercurial pkg-config"
su -c "apt install libxerces-c-dev" # needed only for relpipe-in-xml module
su -c "apt install guile-2.2-dev" # needed only for relpipe-tr-guile module; guile-2.0-dev also works but requires a patch (see below)
su -c "apt install gawk" # needed only for relpipe-tr-awk module
su -c "apt install libxml++2.6-dev" # needed only for relpipe-in-xmltable module
su -c "apt install libsqlite3-dev" # needed only for relpipe-tr-sql module
# Run rest of installation as a non-root user:
export RELPIPE_VERSION="v0.14"
export RELPIPE_SRC=~/src
export RELPIPE_BUILD=~/build
export RELPIPE_INSTALL=~/install
export PKG_CONFIG_PATH="$RELPIPE_INSTALL/lib/pkgconfig/:$PKG_CONFIG_PATH"
export PATH="$RELPIPE_INSTALL/bin:$PATH"
rm -rf "$RELPIPE_BUILD"/relpipe-*
mkdir -p "$RELPIPE_SRC" "$RELPIPE_BUILD" "$RELPIPE_INSTALL"
# Helper functions:
relpipe_download() { for m in "$@"; do cd "$RELPIPE_SRC" && ([[ -d "relpipe-$m.cpp" ]] && hg pull -R "relpipe-$m.cpp" && hg update -R "relpipe-$m.cpp" "$RELPIPE_VERSION" || hg clone -u "$RELPIPE_VERSION" https://hg.globalcode.info/relpipe/relpipe-$m.cpp) || break; done; }
relpipe_install() { for m in "$@"; do cd "$RELPIPE_BUILD" && mkdir -p relpipe-$m.cpp && cd relpipe-$m.cpp && cmake -DCMAKE_INSTALL_PREFIX:PATH="$RELPIPE_INSTALL" "$RELPIPE_SRC/relpipe-$m.cpp" && make && make install || break; done; }
# Download all sources:
relpipe_download lib-protocol lib-reader lib-writer lib-cli lib-xmlwriter in-cli in-fstab in-xml in-xmltable in-csv in-filesystem in-recfile out-gui.qt out-nullbyte out-ods out-tabular out-xml out-csv out-asn1 out-recfile tr-cut tr-grep tr-python tr-sed tr-validator tr-guile tr-awk tr-sql
# Optional: At this point, we have all dependencies and sources downloaded, so we can disconnect this computer from the internet in order to verify that our build process is sane, deterministic and does not depend on any external resources.
# Build and install libraries:
relpipe_install lib-protocol lib-reader lib-writer lib-cli lib-xmlwriter
# Build and install tools:
relpipe_install in-fstab in-cli in-fstab in-xml in-xmltable in-csv in-recfile tr-cut tr-grep tr-sed tr-guile tr-awk tr-sql out-nullbyte out-ods out-tabular out-xml out-csv out-asn1 out-recfile
# relpipe_install in-filesystem # requires GCC 8 or patching (see below)
# Load Bash completion scripts:
for c in "$RELPIPE_SRC"/relpipe-*/bash-completion.sh ; do . "$c"; done
# Clean-up:
unset -f relpipe_install
unset -f relpipe_download
unset -v RELPIPE_VERSION
unset -v RELPIPE_SRC
unset -v RELPIPE_BUILD
unset -v RELPIPE_INSTALL
# View content of SQL scripts like on an 80s green screen terminal!
echo "CREATE TABLE r1 (hello integer, world integer); INSERT INTO r1 VALUES (1,2);" | relpipe-in-sql | relpipe-out-tabular
Download: examples/release-v0.14.sh
Relational pipes are modular thus you can download and install only parts you need (the libraries are needed always).
Tools out-gui.qt
and tr-python
require additional libraries and are not built by default.
The module relpipe-in-filesystem
uses C++ filesystem API which is supported since GCC 8.
This module can be compiled and seems usable even with GCC 6, but requires some patching (switch to the experimental API):
sed 's@#include <filesystem>@#include <experimental/filesystem>@g' -i "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/FileAttributeFinder.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/XattrAttributeFinder.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/FilesystemCommand.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/AttributeFinder.h
sed 's@std::filesystem@std::experimental::filesystem@g' -i "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/FileAttributeFinder.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/XattrAttributeFinder.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/FilesystemCommand.h "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/AttributeFinder.h
sed 's/.*PROPERTY CXX_STANDARD.*/#\0/g' -i "$RELPIPE_SRC"/relpipe-in-filesystem.cpp/src/CMakeLists.txt
The module relpipe-tr-guile
uses GNU Guile 2.2 but can also work with 2.0.
In such case, it requires this patch:
sed 's/guile-2\.2/guile-2.0/g' -i "$RELPIPE_SRC"/relpipe-tr-guile.cpp/src/CMakeLists.txt
Relational pipes, open standard and free software © 2018-2022 GlobalCode