Adapter Development

Adapters are an important part of Polypheny and they play a crucial role in enabling Polypheny to interact with different underlying databases. The adapters are designed to translate the relational algebra into a database-specific query language and to manage the schema on the underlying database. This guide outlines the required steps for adding a new adapter to Polypheny.

Understanding the Role of Store and Sources

Polypheny distinguishes between two different types of adapters: Data Stores and Data Sources.

  • Data Stores have their schema managed by Polypheny. It is expected that Polypheny has the sole and exclusive control over data stores.

  • Data Sources allow querying an external database using Polypheny.

Steps to Implement New Adapters

1. Selecting Feasible Deployment Technique

Polypheny supports three deployment types for adapters:

  • Embedded
  • Docker
  • Remote

When developing a new adapter, you should aim to support all three types. However, if there is no embedded version available or if its use violates our licensing policy, then supporting only Docker and Remote is acceptable.

2. Adding Adapter To Polypheny

To add an adapter to Polypheny, you first need to create a class that extends either DataSource or DataStore. This new class should also define the possible adapter settings. These settings are defined using annotations. This new class is the central component of the adapter.

3. Adding Rules

Polypheny uses an extended relational algebra to represent queries. Each adapter translates this into the native query language of the underlying database. The adapter can define individually how the relational algebra operations are transformed to its own query representation. To do this, it must define adapter-specific rules, such as [adapter name]Project, which defines how a Project is transformed, or [adapter name]Filter, which transforms a Filter operation.

The extended relational algebra consists of the following basic operations:

  • TableScan
  • Project
  • Filter
  • Aggregate
  • Sort

Additionally, it uses special operations for DMLs (Data Manipulation Languages), which are:

  • TableModify
  • Values

These operations need to be registered to the planner.

4. Running the Integration Pipeline

Polypheny is equipped with a comprehensive testing suite, which can be used during development to ensure correct implementation of data stores. To start the testing suite, use the following gradle command:

./gradlew integrationTests -Dstore.default=[New Store Name]

More information about the testing suite can be found in the testing guide.

© Polypheny GmbH. All Rights Reserved.