Skip to content

Specify Trino schemas

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

You can specify the Trino schemas that correspond to the Aerospike sets your client applications will query.

Because it is a SQL engine, Trino requires the schema of the data that you want to query. However, Aerospike is schemaless and has no native meta-store for storing schemas. There are two ways that the Trino connector provides schemas to Trino for running SQL queries against data in Aerospike:

Inferring schemas

By default, the Trino connector uses heuristics to rapidly infer schemas without the need for you to specify them. Client applications can issue all supported types of SQL statements. However, column ordering is alphabetical only.

Using provided schemas

The Trino connector uses JSON files that you provide.

Procedure

To provide schemas for the Trino connector to use, follow these steps:

Organize table definition files

Place table definition files in the directory configured by aerospike.table-desc-dir. At startup, the Trino connector loads every .json file in that directory (top level only). You can use either of these patterns:

One table definition per file

Each file contains a single JSON object that defines one Aerospike set. For example, this file defines table1 in the schema1 namespace:

{
"schemaName": "schema1",
"tableName": "table1",
"columns": [
{
"name": "id",
"type": "varchar",
"hidden": false
},
{
"name": "int",
"type": "bigint",
"hidden": false
},
{
"name": "list",
"type": "json",
"hidden": false
},
{
"name": "map",
"type": "json",
"hidden": false
}
]
}

Multiple table definitions in one file

To define several sets in a single file, wrap the definitions in a JSON array. Each array element is a table definition object:

[
{
"schemaName": "schema1",
"tableName": "table1",
"columns": [
{
"name": "id",
"type": "varchar",
"hidden": false
}
]
},
{
"schemaName": "schema1",
"tableName": "table2",
"columns": [
{
"name": "score",
"type": "bigint",
"hidden": false
}
]
}
]

You can mix both patterns in the same directory. For example, place one set per file for most tables and use a single array file for a group of related sets.

File and loading constraints

  • Only files with a lowercase .json extension are loaded.
  • Only the top-level directory is scanned; subdirectories are not read.
  • Filenames are arbitrary; the connector uses each object’s schemaName (namespace) and tableName (set), not the filename.
  • Each schemaName and tableName pair must be unique across all loaded files. If the same pair appears more than once, Trino fails to start when loading the Aerospike catalog.
  • Restart Trino after you add, change, or remove definition files.
  • When any definition files are present, SHOW TABLES lists only the sets defined in JSON. You can still query other sets directly; the connector infers their schemas at query time.

Specify the location of the JSON files

If you are setting up a non-containerized environment, follow these steps:

  1. Place the JSON files in a single directory.

  2. In the file <trino_dir>/etc/catalog/aerospike.properties, add the property aerospike.table-desc-dir and set its value to the path of the directory.

If you are setting up a containerized environment, place the JSON files in a single directory. When you deploy a Trino cluster, you mount that directory to each container that you create with the docker run command.

What to do next

Return to the steps in Deploy Trino clusters and Trino connector in Docker.

Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?