You can use a PostgreSQL database as a data store in your sapi-nt application.
Before configuring your integration, you should add the relevant dependencies to your project’s pom.xml.
These include the Spring JDBC integration and the JDBC driver of your choice.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
You can configure a sapi-nt data source which accepts SQL queries.
Time series endpoints can use a PostgreSQL database as their data source.
SQL data source specs have a type of dataSource.sql,
and require no further configuration in the spec file.
The underlying data source is configured by the Spring framework,
using properties that are set in your application configuration
(eg. application.yaml).
These properties configure the SQL database connection and other parameters, including authentication.
See the example below for a minimal configuration.
name : tsDataSource
type : dataSource.sql
# application.yaml
spring:
datasource:
platform: postgres
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/dbname
username: postgres
password: password
Since the SQL data source uses the same auto-configuration as armlib integration, it is not possible to use both features on separate databases in a single sapi-nt application. This may be addressed in a future release.