Getting started

This section explains how to get started using DirectQuery to connect to an external Database.

tip

For an overview of DirectQuery, see the DirectQuery Overview section in the User Guide.

To connect to a remote Database using DirectQuery you need to complete these steps:

  1. Configure your remote Database in Atoti Market Risk's expected Database format
  2. Set the Atoti Market Risk configuration properties
  3. Deploy Atoti Market Risk in Horizontal Distribution

Database schema

Your remote Database must be configured in the same format as Atoti Market Risk's in-memory datastores. This means the same Tables and Field Types will need to be replicated. You can do this by defining the Tables as outlined in the Database documentation or by exposing Views on your Database in the same expected Database format.

note

All of the Database Tables must be present either as actual Tables or Views on your connected Database.

DirectQuery properties

The following properties must be configured to get started with DirectQuery.

Profiles

The application provides Spring profiles for each natively supported database. These profiles contain the properties to start Atoti Market Risk in DirectQuery mode and connect to the database. You can find these profiles in the mr-application/src/main/resources/ directory:

You can use these profiles as a starting point for your own configuration.

Deployment type

You must set the deployment type to direct-query for Atoti Market Risk to run as a DirectQuery application.

starter:
  deployment:
    type: direct-query

This property is already set in the provided profiles.

Disable summary cubes

The Atoti Market Risk summary cubes aren’t supported when using DirectQuery. You must disable them from the configuration file by setting those properties:

mr:
  enable:
    cubes:
      var-summary: false
      pnl-summary: false
      sensi-summary: false

These properties are already set in the provided profiles.

Database-specific properties

The provided profiles are a good starting point to configure your Atoti Market Risk DirectQuery application. For specific environments and use-cases, you may need to adjust some of these properties. There are also additional properties not included in the profiles. See DirectQuery properties for the full list of properties.

Deployment options

We provide two main options to run with DirectQuery:

Option How to run  Atoti Market Risk
Operate with some data loaded in-memory and the rest available through DirectQuery In Horizontal Distribution with in-memory Database
Run purely on DirectQuery remote data In a Single JVM on DirectQuery only

Horizontal distribution

In Horizontal Distribution you have access to the in-memory tools such as What-If, data updates and Sign-Off for the data loaded in-memory as well as access to a large number of historical dates.

When running in Horizontal Distribution you need to run three Nodes:

  • Query node
  • In-memory data node
  • DirectQuery data node

Query node

The query node is responsible for handling all queries from the client and coordinating with the data nodes to retrieve the required data.

Activate the dist-query-node Spring profile to start the application in query node mode.

In-memory data node

The in-memory data node stores recent data in-memory and efficiently handles queries that can be answered from this in-memory data.

Activate the dist-data-node Spring profile to start the application in data node mode.

DirectQuery data node

The DirectQuery data node handles queries that need to be answered from the external database.

Select the profile corresponding to your database from the provided profiles to start the application in DirectQuery data node mode. You also need to set the following property to enable communication with the query node:

starter:
  deployment:
    transport: netty

Ports

By default, Atoti Market Risk runs on port 10010. If you are running multiple nodes on the same machine, you need to change the port for each node. You can do this by setting the following property server.port property, providing a different value for each node.

Dates

It’s likely that your database and your in-memory data node may contain overlapping dates. This requires special handling in a horizontally distributed setup.

Sign-Off

Sign-Off is not supported with DirectQuery but, using horizontal distribution, you can create a cluster in which there is a DirectQuery data node and an in-memory data node for which Sign-Off features are enabled. For details on this setup, see Adjustments in the DirectQuery database..

Single JVM

You can run a single JVM consisting of only DirectQuery. This will not contain any in-memory data.

Properties

To run the Single JVM node, you only need to configure the DirectQuery properties and run the application as normal. There are no distributed nodes to configure when running in a single JVM.

Single JVM limitations

Running DirectQuery with a single JVM means you are running purely on DirectQuery. This comes at the compromise of query performance of Trade-level queries and also doesn’t have access to in-memory only tools (such as What-If and Sign-Off).

note

Running both an in-memory data node and DirectQuery data node under a single JVM isn’t supported.

Reference database

Atoti Market Risk ships with the SQL scripts and data needed to initialize a Databricks database that can be used for testing. The scripts and reference data are located within the directory: mr-directquery/src/test/resources/databases/databricks/.

Atoti Market Risk ships with an example MSSQL database that can be used for testing. This database runs inside a Docker container. It is located within the directory: mr-directquery/src/test/resources/databases/mssql/.

Atoti Market Risk ships with the SQL and data needed to initialize a Snowflake database that can be used for testing. The SQL scrip is located within the directory: mr-directquery/src/test/resources/databases/snowflake/. The reference data can be found in the mr-application/src/main/resources/data/ directory.