Appendix: Databases, Queries, Functions, and Configurations
Query Catalog
Query with permissions
a query on database 'dj/northwind' called 'group', executable for the 'authenticated' role
{
"ID" : "group",
"database" : "dj/northwind",
"query" : "SELECT CUSTOMERS.COUNTRY, COUNT(*) AS \"Number of Customers\" FROM CUSTOMERS GROUP BY CUSTOMERS.COUNTRY",
"roles" : [ "authenticated" ],
"type" : "read"
}
Query with parameters
a query on database 'northwind' called 'list'. Parameters limit and offset can be passed to the query
{
"ID" : "list",
"database" : "dj/northwind",
"query" : "select * from CATEGORIES limit ${limit} offset ${offset}",
"type" : "read",
"arguments" : {
"limit" : {
"type" : "number",
"sample" : "5"
},
"offset" : {
"type" : "number",
"sample" : "0"
}
}
}
Calling a stored procedure
stored procedure 'sp' on database 'postgres' called with parameter 'test'
Databases
Database connection
postgres database connection information with encrypted password
{
"name" : "postgres",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"username" : "postgres",
"url" : "jdbc:postgresql://localhost:5432/postgres",
"ID" : "dj/postgres",
"password" : "DJ1#\b/gbzX8DDZa1lVaiLat0HdX9cDST2KHJk"
}
Database audit log trigger
sqlite database definition. The before-update trigger is called accordingly and logs an audit record to the table audit
{
"name" : "sqlite",
"ID" : "dj/sqlite",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"url" : "jdbc:sqlite:dashjoin-demo.db",
"tables" : {
"REQUESTS" : {
"before-update" : "$create('db', 'audit', {'timestamp': $now(), 'user': user, 'operation': command, 'payload': object})"
}
}
}
Database with initial create table
sqlite database definition with init script that contains: CREATE TABLE IF NOT EXISTS MY_TABLE(ID INT PRIMARY KEY, NAME VARCHAR(255))
{
"name" : "sqlite",
"ID" : "dj/sqlite",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"url" : "jdbc:sqlite:dashjoin-demo.db",
"initScripts" : [ "upload/init.sql" ]
}
Database with foreign key
sqlite database definition with a foreign key pointing to the CUSTOMERS table in the northwind database
{
"name" : "sqlite",
"ID" : "dj/sqlite",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"url" : "jdbc:sqlite:dashjoin-demo.db",
"tables" : {
"REQUESTS" : {
"properties" : {
"customer" : {
"ref" : "dj/northwind/CUSTOMERS/CUSTOMER_ID",
"displayWith" : "fk"
}
}
}
}
}
Database with foreign key array
postgres database definition with an array of foreign keys pointing to the CUSTOMERS table in the northwind database
{
"name" : "postgres",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"username" : "postgres",
"password" : "DJ1#\bApQHRIfZwu6WSIJrlI2aBqbMhnLRPlsg",
"url" : "jdbc:postgresql://localhost:5432/postgres",
"ID" : "dj/postgres",
"tables" : {
"test" : {
"properties" : {
"arr" : {
"type" : "array",
"items" : {
"ref" : "dj/northwind/CUSTOMERS/CUSTOMER_ID",
"type" : "string",
"displayWith" : "fk"
}
}
}
}
}
}
Database with record label
EMPLOYEES table defines the record label to be the LAST_NAME. All links and page titles for EMPLOYEE records use the LAST_NAME column as labels
{
"ID" : "dj/northwind",
"name" : "northwind",
"parent" : "dj",
"djClassName" : "org.dashjoin.service.SQLDatabase",
"url" : "jdbc:h2:mem:northwind",
"tables" : {
"EMPLOYEES" : {
"dj-label" : "${LAST_NAME}"
}
}
}
KnowledgeBase
Expose the RAG document knowledge base to the platform. It has the tables Document and Tag. Load documents with a standard ETL function into this database (see 'ETL into the RAG knowledge base'), list them with $all('kb', 'Document'). AIApp functions use the URL of the first KnowledgeBase as the AI service URL
{
"ID" : "dj/kb",
"name" : "kb",
"djClassName" : "com.dashjoin.ai.KnowledgeBase",
"url" : "http://localhost:8001"
}
Function Catalog
Invoke
Function that adds two numbers passed in the argument object. It can be called via $call('add') or via REST
{
"ID" : "add",
"djClassName" : "org.dashjoin.function.Invoke",
"expression" : "{'result': x+y}",
"roles" : [ "authenticated" ],
"type" : "read"
}
RestJson
Function that calls a web service. The fields of the function argument are used to construct the URL via from string template
{
"djClassName" : "org.dashjoin.function.RestJson",
"url" : "https://api.geoapify.com/v1/geocode/search?street=${street}&postcode=${postcode}&city=${city}&country=${country}&apiKey=...",
"method" : "GET",
"contentType" : "application/json",
"ID" : "address"
}
Credentials
Encrypted credentials for OpenAI to be used in $curl and $chat functions
{
"ID" : "openai",
"djClassName" : "org.dashjoin.function.Credentials",
"username" : "Authorization",
"password" : "DJ1#\b7Zw3EGtmVKaDuwwOtwXfWDG1y+awbon7WNQp9NmJ6EgUXEpYUMC8O7zRUw2kSnDxyATO0R3ke3NxjaT9zCwYyDGS5VDgYt/L",
"apiKey" : true
}
ETL
Extract load transform function. Loads the result of 'expression' into the database sqlite. The data is mapped using 'mappings'
{
"djClassName" : "com.dashjoin.function.ETL",
"database" : "sqlite",
"ID" : "misp",
"type" : "write",
"oldData" : "Delete All",
"createSchema" : true,
"mappings" : {
"MISP_Event" : {
"sourceTable" : "table",
"extractColumn" : null,
"extractKey" : null,
"pk" : "uuid",
"rowMapping" : null,
"rowFilter" : null
}
},
"expressions" : {
"expression" : "$openJson(\"https://www.circl.lu/doc/misp/feed-osint/0b988513-9535-42f0-9ebc-5d6aec2e1c79.json\").Event.Attribute"
}
}
ETL into the RAG knowledge base
Loads documents for RAG (retrieval augmented generation) into the AI knowledge base. The knowledge base (djClassName com.dashjoin.ai.KnowledgeBase, here the database kb) is a normal Dashjoin database, so the standard ETL is used, not a custom function. The expression returns {'Document': [...]}. Each record has 'document' (a list with one object: 'name' = file name or URL, which becomes the document's path, and 'value' = base64 content) and optional 'tags'. Read files with $openText(url, 'BASE_64'). Text generated from other tables can be added with $base64encode(text). Keep createSchema false because the tables Document and Tag are fixed. Use oldData 'Ignore': documents are matched by name and only re-embedded if their content changed; 'Delete All' re-ingests everything. Run with $call('rag') and check with $all('kb', 'Document').
{
"djClassName" : "com.dashjoin.function.ETL",
"ID" : "rag",
"type" : "write",
"database" : "kb",
"createSchema" : false,
"oldData" : "Ignore",
"expressions" : {
"expression" : "{'Document': [$ls('file:upload/kb')[folder = false].{'tags': ['manual'], 'document': [{'name': url, 'value': $openText(url, 'BASE_64')}]}, {'tags': ['faq'], 'document': [{'name': 'faq.md', 'value': $base64encode($join($all('sqlite', 'FAQ').('## ' & question & '\\n' & answer), '\\n\\n'))}]}]}"
}
}
Configures an SMTP server
{
"djClassName" : "org.dashjoin.function.Email",
"ID" : "email",
"type" : "write",
"properties" : {
"mail.smtp.port" : "25"
},
"username" : "user",
"password" : "DJ1#\btW06MCaBJjnRvgvGgTaTpQ=="
}
MCPServer
Configures an MCP server
{
"djClassName" : "org.dashjoin.function.MCPServer",
"ID" : "mcp",
"url" : "https://mcp.notion.com/mcp",
"username" : "Authorization",
"password" : "DJ1#\b7Zw3EGtmVKaDuwwOtwXfWDG1y+awbon7WNQp9NmJ6EgUXEpYUMC8O7zRUw2kSnDxyATO0R3ke3NxjaT9zCwYyDGS5VDgYt/L",
"apiKey" : true
}
Receive
Function can be called by clients to feed data into a table. Basically an ETL where the extract part is done on the REST client
{
"ID" : "receive",
"djClassName" : "org.dashjoin.mapping.Receive",
"sample" : "{\"name\": \"tester\"}",
"mappings" : {
"REQUESTS" : {
"sourceTable" : "table"
}
},
"createSchema" : false,
"database" : "sqlite"
}
AIApp
Configures an AI application with system prompt, tools, and RAG
{
"ID" : "aia",
"djClassName" : "com.dashjoin.ai.AIApp",
"systemPrompt" : "You are a helpful assistant",
"tools" : [ "time:get_current_time" ],
"model" : "mistral",
"documents" : [ "rag.txt" ]
}
Configuration
login configuration
Login configuration for ACME Corp. App with a specific login screen background image. Users can choose between the 'de' and 'en' locales. The default is the browser locale.
{
"signInTabText" : "ACME Corp. App",
"defaultLocale" : "browser",
"locales" : [ "en", "de" ],
"backgroundImage" : "https://example.org/logo.jpg"
}
theme
sets the UI theme. in this example, we set the primary and secondary color
{
"ID" : "theme",
"map" : {
"palette.primary.main" : "#3d7dbc",
"palette.secondary.main" : "#3d7dbc"
}
}
dark-theme
sets the UI dark theme. in this example, we set the primary and secondary color
{
"ID" : "theme",
"map" : {
"palette.primary.main" : "#3d7dbc",
"palette.secondary.main" : "#3d7dbc"
}
}
sidenav-width-px
sets the sidenav width to 100px. 0 hides the sidenav
sidenav-open
sidenav is closed by default
search-timeout-ms
Query timeout in milliseconds for queries issued when searching data. To disable the timeout, set to 0
prioritize-table-in-search
Tables in this list are searched first
on-start
Expression to run when the system starts. Can be used to initialize the database, etc...
on-login
Expression run whenever a user logs in. In this example, only allow the admin user to login
logo-url
specifies the logo to show in the toolbar
include-table-in-search
Only search the EMPLOYEES table
homepage
Page to open after the user logs in
exclude-table-from-search
Do not search the EMPLOYEES tables
exclude-database-from-search
do not search the sqlite database
i18n
Specify german translations for strings appearing in the app
database-search-query
Configures searches on the northwind DB to use the query 'search' from the query catalog (select * from EMPLOYEES where LAST_NAME like CONCAT(${search}, '%'))
allow-dark-mode
disallow dark mode
base-theme
change the base theme
autocomplete-timeout-ms
sets the timeout for autocomplete queries to 1 second
all-timeout-ms
Query timeout in milliseconds for queries issued when browsing data. To disable the timeout, set to 0.
single-session
Limits how many devices a user can be logged in on at the same time. The newest login wins: when a user exceeds maxSessions (default 1), the oldest session is logged out. Users in one of the exemptRoles (e.g. technical users or webhooks) are not restricted. The feature is off as long as no map is set
tenantusers
user@example.org is allowed (active) on the platform and is in the role 'authenticated'
tenantusers
Sets the 'homepage' variable (the initial page after login) to '/page/test' for user@example.org (overrides the global and role setting for 'homepage')
dj-role
defines the role 'admin'. Sets the 'homepage' variable (the initial page after login) is set to '/page/Info' for all users in this role (overrides the global setting 'homepage')
platform-url
Platform URL to be used from the AI service
exception-mapper
Error messages containing the key are replaced with the value
{
"ID" : "exception-mapper",
"map" : {
"ERROR: duplicate key value violates unique constraint \"Prompt_pkey\"" : "This ID is already in use. Please use another one."
}
}
de
Contains I18N mappings. Use any ISO 3166-1 alpha-2 code instead of 'de'