ITTIA DB SQL Getting Started Guide - Phytec
ITTIA DB SQL Getting Started Guide - Phytec
June 2021
Contents
Introduction.....................................................................................................................................................................3
About ITTIA DB SQL Database ...............................................................................................................................3
About Phytec phyCore-i.MX 8M Mini ..................................................................................................................3
Obtaining ITTIA DB SQL for phyCore-i.MX 8M Mini/Nano ......................................................................3
Running the Database for the First Time ..........................................................................................................4
Connecting to the ITTIA DB Console with a Browser..................................................................................5
Process Time Series Embedded Data .............................................................................................................5
Concurrent Read and Write to Flash Media ................................................................................................8
Secure Data on the Device with DB-SEAL ....................................................................................................9
ITTIA DB SQL Package Contents......................................................................................................................... 10
Programs ................................................................................................................................................................... 11
Libraries .................................................................................................................................................................... 11
Documentation....................................................................................................................................................... 11
How to Setup Yocto Linux for Application Development with ITTIA DB SQL.............................. 12
Technical Support ...................................................................................................................................................... 12
Introduction
The purpose of this document is to provide information on data processing, management,
and distribution for i.MX 8M Mini/Nano devices manufactured by Phytec. The i.MX 8
applications processor is a feature- and performance-scalable multicore platform that
includes single-, dual- and quad-core families based on the Arm Cortex architecture. Each
section on this document describes a specific set of steps to embed database with this i.MX
8 applications processor. The target audience for this document is developers.
4. Transfer ITTIA DB SQL and License Certificate file to the target hardware. For
example, from a Linux host or Windows 10 host with April 2018 Update:
$ scp ittia_db_sql-*-aarch64-poky-linux.tar.gz [email protected]:
$ scp ittia_license.dat [email protected]:
5. On the target hardware, set the ITTIA_LICENSE environment variable to file name of
the License Certificate:
# export ITTIA_LICENSE=$HOME/ittia_license.dat
6. Extract ITTIA DB SQL on the target hardware:
# tar xf ittia_db_sql-*-aarch64-poky-linux.tar.gz
This command starts the ITTIA DB Console HTTP server and creates an empty database file
in the current directory.
You can use the ITTIA DB Console to submit data to an IoT Stream directly from a web
browser. Open ITTIA DB Console in a new browser window, select drill_sensors from the
sidebar, and go to the Content tab.
Press the Generate button to start generating data at a constant sample rate. Press
Increment or Random next to any field to change the value over time.
A continuous query processes new data from a data source and displays changes to the
query result state in real time.
To manually execute a continuous query in your web browser, open ITTIA DB Console in a
new browser tab or window, select drill_sensors from the sidebar. Go to the Query tab and
execute this statement:
cselect *
from drill_sensors
where temperature_C > 70
The results of this query will initially be empty. But when data matching the where clause is
submitted by a sensor_data data source, it will be immediately displayed in the continuous
query browser tab or window. Furthermore, if data is submitted that does not match the
where clause, the row corresponding to that sensor will be immediately removed.
Multiple continuous queries can be run at the same time. To run another query, open the
same drill_sensors Query tab but in another browser tab. Execute this statement:
cselect sensor_id,
8.314 * (temperature_C + 273.15) / pressure_Pa
as volume_m3_per_mol
from drill_sensors
This query calculates the volume per mol of each sensor from the ideal gas law, PV=nRT.
Once the data from the drill_sensors stream is in the high_temperature_events table, more
traditional SQL queries can be executed in the Query tab. This can be useful to answer
questions that require looking back at the data over a long period of time. For example, the
following query identifies the sensors that spent the most time with a temperature
exceeding 70 degrees Celsius over the last 24-hour period.
select sensor_id,
count(*) as number_of_events,
sum((end_time – start_time) second) as total_duration
from high_temperature_events
where start_time > localtimestamp – interval '1' day
group by sensor_id
order by sum((end_time – start_time) second) desc
fetch first 10 rows only
Folder Description
meta-ittia-ittiadb-sdk/recipes/ittiadb ITTIA DB SQL SDK
meta-ittia-ittiadb-sdk/recipes/ittia-api-examples-c C API example programs
meta-ittia-ittiadb-sdk/recipes/ittia-api-examples-cpp C++ API example
programs
meta-ittia-ittiadb-sdk/conf OpenEmbedded layer
configuration
The contents of the ITTIA DB SQL SDK can also be accessed directly from the meta-ittia-
ittiadb-sdk/recipes/ittiadb/ittiadb-${VERSION}/${ARCH}/ directory inside the
package. This directory has the following folder structure:
Folder Description
include Header files for ITTIA DB SQL
lib ITTIA DB SQL libraries
bin Utilities and applications
share/doc/ittiadb/manuals Manuals
examples Example programs
src Supplemental database support source code
When added to a Yocto Linux project as a layer, the following packages are available:
Package Description
ittiadb ITTIA DB SQL programs
libittiasql1 ITTIA DB SQL libraries
libittiasql1-dev Headers for ITTIA DB SQL libraries
libstorage-staticdev ITTIA DB C++ API
ittia-api-examples-c C API example programs
ittia-api-examples-cpp C++ API example programs
Programs
Programs are available after installing the ittiadb package or copying the contents of
meta-ittia-ittiadb-sdk/recipes/ittiadb/ittiadb-${VERSION}/${ARCH}/bin/ to the
target system.
ITTIA DB SQL includes an interactive utility that can be run with the command ittiadb.
ITTIA DB SQL includes a light-weight data server for shared access to database files. Run
the dbserver command to start the data server.
Libraries
The ITTIA DB SQL kernel is a software library that can be directly embedded in an
application or accessed through a separate server process. The database kernel provides a
transactional C API that the application can use directly or through a variety of higher-level
APIs, include the ITTIA DB SQL C++ API, libstorage.
Documentation
ITTIA DB documentation includes:
6. Embedded Database Manual: The essential guide to ITTIA DB usage and software
development.
7. C API Reference: Reference manual for the ITTIA DB C API.
8. C++ API Reference: Reference manual for the ITTIA DB C++ API.
How to Setup Yocto Linux for Application Development with ITTIA DB
SQL
The Phytec L-1002e.A0 i.MX 8M Mini BSP Manual provides instructions to build the BSP
image and boot it onto the phyCORE-i.MX 8M Mini/Nano environment. Application
development requires a Linux build host. Follow the BSP Manual:
1. Start with the Get the BSP section and continue and stop when you get to the
Starting the Build Process section.
2. Install dependencies for the BSP using the command:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm
7. Deploy the system image to the target device. Directions for different deployment
options can be found in the BSP Manual under the section System Booting.
Technical Support
Do you need assistance with edge device data processing and management? Contact
[email protected] to request support.
Information in this document is provided solely to enable system and software implementers
to use ITTIA products. No express or implied copyright license is granted hereunder to design
or implement any database management system software based on the information in this
document. ITTIA reserves the right to make changes without further notice to any products
described herein. ITTIA makes no warranty, representation or guarantee regarding the
suitability of its products for any particular purpose, nor does ITTIA assume any liability
arising out of the application of or use of any product, and specifically disclaims any and all
liability, including without limitation consequential or incidental damages. Statistics and
parameters provided in ITTIA white papers and data sheets can and do vary in different
applications and actual performance may vary over time. All operating parameters must be
validated for each customer application by customer's technical experts. ITTIA and the ITTIA
logo are trademarks or registered trademarks of ITTIA L.L.C. in the U.S. and other countries.
All other product or service names are the property of their respective owners.
Copyright (c) 2021 ITTIA L.L.C. All rights Reserved. References in this document to ITTIA
products and services do not imply that ITTIA intends to make them available in every
country.