Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:APIJSON APIJSON Demo DemoSQLConfig ES

From Leeroopedia
Knowledge Sources
Domains Database, Elasticsearch, SQL_Generation
Last Updated 2026-10-14 00:00 GMT

Overview

Concrete tool for configuring SQL generation with dynamic Elasticsearch data source resolution and UUID-based ID generation in the APIJSON Elasticsearch multi-datasource demo.

Description

The DemoSQLConfig class (Elasticsearch variant) extends APIJSONSQLConfig<Object> with a SimpleCallback that creates new DemoSQLConfig instances and generates UUID-based IDs for non-system tables. It overrides getDBVersion and getDBUri to resolve connection details dynamically from DynamicJdbcDataSource by datasource name. It also registers a table-name mapping for ES_blog.

Usage

Use this class when the APIJSON Elasticsearch demo needs to generate SQL for dynamically resolved Elasticsearch or JDBC data sources.

Code Reference

Source Location

Signature

public class DemoSQLConfig extends APIJSONSQLConfig<Object> {
    static {
        TABLE_KEY_MAP.put("ES_blog", "es_blog");
        SIMPLE_CALLBACK = new SimpleCallback<String>() {
            @Override
            public AbstractSQLConfig getSQLConfig(RequestMethod method, String database, String schema,
                    String datasource, String table);
            @Override
            public String newId(RequestMethod method, String database, String schema, String datasource, String table);
        };
    }
    @Override
    public String getDBVersion();
    @Override
    public String getDBUri();
}

Import

import apijson.demo.DemoSQLConfig;

I/O Contract

Inputs

Name Type Required Description
datasource String No Datasource name for dynamic resolution
table String Yes Target table name

Outputs

Name Type Description
getDBVersion() returns String Database version from DynamicJdbcDataSource
getDBUri() returns String JDBC URI from DynamicJdbcDataSource
newId() returns String UUID string for new records

Usage Examples

Dynamic Datasource Query

// APIJSON request using dynamic ES datasource
{
  "[]": {
    "ES_blog": {
      "title$": "%search%"
    }
  }
}
// DemoSQLConfig resolves datasource details from DynamicJdbcDataSource

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment