ALBA CLI¶
libhdbpp-python CLI¶
Pre-requisite¶
PyYAML
psycopg2
Installation Steps
Clone the following repository using this link : https://gitlab.com/tango-controls/hdbpp/libhdbpp-python
Change directory to libhdbpp-python
cd libhdbpp-pythonRun the below command to begin installation
pip install .OR
Run make target directly from ska-tango-archiver repo
make install-libhdbpp-python
Usage Manual
The hdbpp-reader command-line tool is used for data extraction. Here is the usage manual
hdbpp-reader [-h] [-v] [-D] [--syslog] [-b BACKEND] [-P] [-c CONFIG] [-C CONNECT] [-d DATABASE] [-H HOST] [-u USER] [-p PASSWORD] [-t TIMEFORMAT] {list,read} ...
To use timescaledb as the backend, use the –backend argument as follows
--backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader
Connection details can be provided using connection string ,config file or argument
host: <timescaledb_host_name> database: <database name> user: <database user> password :<database password> port: <port
List Function: to list attributes
-P --pattern = this option can be used to search pattern using config file for connection: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader -c config.yaml list -P "*" using connection details as arguments: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader list -P "*" host (default localhost):10.200.10.143 or timescaledb.ska-eda-mid-db.svc.cluster.local <for mid> or host (default localhost): 10.200.12.14 or timescaledb.ska-eda-low-db.svc.cluster.local <for low> port (default 3306):5432 database (default hdb):ska_archiver_hm_71 user:admin output: 2022-11-07 17:17:21 hdbpp_reader[685660]: Loaded config file: config.yaml tango://tango-host-databaseds-from-makefile-test.ci-ska-tango-archiver-965447b4.svc.cluster.local:10000/sys/tg_test/1/double_scalar Listing attributes double_scalar: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader -c config.yaml list -P "*/double_scalar" Listing attributes of test device: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleescaleDbReader -c config.yaml list -P "*/sys/tg_test/1/*"
READ Function: to list attributes
-P --pattern = this option can be used to search pattern`` using config file for connection: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader -c config.yaml read <attribute_full_name> for example: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader -c config.yaml read tango://tango-host-databaseds-from-makefile-test.ci-ska-tango-archiver-e6c90079.svc.cluster.local:10000/sys/tg_test/1/double_scalar output: 2022-11-07 17:36:00 hdbpp_reader[705016]: Loaded config file: config.yaml (datetime.datetime(2022, 11, 7, 11, 29, 1, 489121, tzinfo=datetime.timezone.utc), 87.55708576347412, 0.0, 0, None) using connection details as arguments: hdbpp-reader --backend=pyhdbpp.timescaledb.timescaledb.TimescaleDbReader read <attribute_full_name> host (default localhost):10.200.10.143 or timescaledb.ska-eda-mid-db.svc.cluster.local <for mid> or host (default localhost): 10.200.12.14 or timescaledb.ska-eda-low-db.svc.cluster.local <for low> port (default 3306):5432 database (default hdb):ska_archiver_hm_71 user:admin password:adminUsing Python Console
For using Python Console please refer Timescale DB Reader Jupyter Notebook (timescaledb_reader.ipynb)