Skip to main content
Atoti DirectQuery reaches the data stored in an external database through a DirectQuery connector. For an overview of DirectQuery, read Introduction to DirectQuery.

What is a DirectQuery connector?

A DirectQuery connector lets Atoti run queries on an external database. Atoti generates these queries from the cube and the operations requested by users. The database runs each query and returns the result to Atoti. The connector holds the information needed to reach the database:
  • The address of the database, usually a connection string.
  • The credentials of the database user.
  • Settings that control how DirectQuery queries the database, such as query timeouts.
Each connector works with one type of database. Most supported databases have their own connector, and other databases use the Generic JDBC connector. For the list of supported databases, read DirectQuery database compatibility. The connector is packaged differently in each SDK:
  • Atoti Java SDK: each connector is a Maven module added to the Atoti application. The application creates a DirectQueryConnector with the connector factory of the database.
  • Atoti Python SDK: each connector is a plugin installed as a Python package. The plugin adds the Java connector to the Java engine underneath, so both SDKs use the same connector. Session.connect_to_external_database() sets up the connector and returns an ExternalDatabaseConnection. Despite its name, this object represents the connector, not a single connection to the database.
For installation instructions for the Python plugins, read Plugins in the Atoti Python SDK documentation.

What does “external database” mean in DirectQuery?

In DirectQuery, the external database is the data source that holds the fact-level data. Atoti queries this data where it is stored, without loading it into the in-memory Atoti Datastore. The Atoti Content Server can also store its content in a relational database. That database holds dashboards, calculated measures, and user settings, not the data queried by the cube. The Content Server database is not an external database in the DirectQuery sense. For more information, read Atoti Content Server.

What does the connector expose?

A DirectQuery connector exposes the tables of the external database. Atoti can discover these tables and their columns through the connector. The application then selects the tables it needs and adds them to the DirectQuery schema.

Which permissions does the database user need?

The connector authenticates as a user of the external database. This user is not a person: it is the database account of the Atoti application. The database sets the available authentication methods, such as a password, a key file, or a token. The database-side requirements are the same in the Atoti Java SDK and the Atoti Python SDK. Both SDKs use the same DirectQuery connector, so the database sees the same user and the same queries. At a minimum, the database user needs the permissions to:
  • Connect to the database, and to the warehouse or compute resource where one is required.
  • Read the schemas and tables used by the application.
  • Run queries on the database.
The exact permissions depend on the database. For example, ClickHouse also requires read access to some system tables. The connection how-to for each database lists the permissions that database requires. For links to each how-to, read Where is the connection setup for each database?.

How does DirectQuery manage connections to the database?

To run a query, the connector opens a connection to the database: a session that sends SQL and receives the results. Most DirectQuery connectors use a connection pool. A connection pool keeps a set of open connections and reuses them across queries. Reusing connections avoids the cost of opening a new connection for every query. The connectors that use the JDBC standard use the HikariCP connection pool:
  • Amazon Redshift
  • Databricks
  • Generic JDBC
  • Microsoft Azure Synapse
  • Microsoft SQL Server
  • Snowflake
The Google BigQuery and ClickHouse connectors use their own client libraries instead. The HikariCP connection pool behaves as follows by default:
  • Connections are opened on demand, when a query needs one.
  • The maximum number of connections is set automatically, based on the number of CPU cores available.
The HikariCP connection pool can be tuned with a HikariCP configuration file. This works for every connector that uses HikariCP, in both SDKs. DirectQuery sets some pool settings itself, and the configuration file cannot change them. Find out how to set the HikariCP configuration file with:
  • Atoti Java SDK: the hikaricp.configurationFile Java system property
  • Atoti Python SDK: java_options, with -Dhikaricp.configurationFile=<path>

Where is the connection setup for each database?

Find out how to connect to each database with: