CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-jooq--jooq-meta

Database metadata abstraction library for jOOQ's code generation system providing unified access to schema information across multiple database vendors

Pending
Overview
Eval results
Files

schema-discovery.mddocs/

Schema Structure Discovery

Complete schema exploration including catalogs, schemas, tables, and views with comprehensive metadata extraction across all database objects.

Capabilities

Catalog Operations

Database catalog discovery and navigation for multi-catalog database systems.

/**
 * Gets all catalogs in the database
 * @returns List of catalog definitions
 */
List<CatalogDefinition> getCatalogs();

/**
 * Gets a specific catalog by name
 * @param name - Catalog name to lookup
 * @returns Catalog definition or null if not found
 */
CatalogDefinition getCatalog(String name);

/**
 * Gets configured input catalog names
 * @returns List of input catalog names from configuration
 */
List<String> getInputCatalogs();

Usage Examples:

import org.jooq.meta.Database;
import org.jooq.meta.CatalogDefinition;

// Get all catalogs
List<CatalogDefinition> catalogs = database.getCatalogs(); 
for (CatalogDefinition catalog : catalogs) {
    System.out.println("Catalog: " + catalog.getName());
}

// Get specific catalog
CatalogDefinition catalog = database.getCatalog("production_db");
if (catalog != null) {
    System.out.println("Found catalog: " + catalog.getQualifiedName());
}

Schema Operations

Schema discovery and navigation within catalogs or across the entire database.

/**
 * Gets all schemas across all catalogs
 * @returns List of all schema definitions
 */
List<SchemaDefinition> getSchemata();

/**
 * Gets schemas within a specific catalog
 * @param catalog - Catalog to search within
 * @returns List of schema definitions in the catalog
 */
List<SchemaDefinition> getSchemata(CatalogDefinition catalog);

/**
 * Gets a specific schema by name
 * @param name - Schema name to lookup
 * @returns Schema definition or null if not found
 */
SchemaDefinition getSchema(String name);

/**
 * Gets configured input schema names
 * @returns List of input schema names from configuration
 */
List<String> getInputSchemata();

/**
 * Gets input schema names for a specific catalog
 * @param catalog - Catalog definition
 * @returns List of input schema names in the catalog
 */
List<String> getInputSchemata(CatalogDefinition catalog);

/**
 * Gets input schema names for a specific catalog by name
 * @param catalog - Catalog name
 * @returns List of input schema names in the catalog
 */
List<String> getInputSchemata(String catalog);

Usage Examples:

import org.jooq.meta.Database;
import org.jooq.meta.SchemaDefinition;
import org.jooq.meta.CatalogDefinition;

// Get all schemas
List<SchemaDefinition> schemas = database.getSchemata();
for (SchemaDefinition schema : schemas) {
    System.out.println("Schema: " + schema.getQualifiedName());
    System.out.println("Comment: " + schema.getComment());
}

// Get schemas in specific catalog
CatalogDefinition catalog = database.getCatalog("mydb");
List<SchemaDefinition> catalogSchemas = database.getSchemata(catalog);

// Get specific schema
SchemaDefinition publicSchema = database.getSchema("public");

Table Discovery

Comprehensive table and view discovery with filtering and navigation capabilities.

/**
 * Gets all tables across all schemas
 * @returns List of all table definitions
 */
List<TableDefinition> getTables();

/**
 * Gets tables within a specific schema
 * @param schema - Schema to search within
 * @returns List of table definitions in the schema
 */
List<TableDefinition> getTables(SchemaDefinition schema);

/**
 * Gets a specific table by schema and name
 * @param schema - Schema containing the table
 * @param name - Table name to lookup
 * @returns Table definition or null if not found
 */
TableDefinition getTable(SchemaDefinition schema, String name);

/**
 * Gets a specific table with case sensitivity control
 * @param schema - Schema containing the table
 * @param name - Table name to lookup
 * @param ignoreCase - Whether to ignore case in name matching
 * @returns Table definition or null if not found
 */
TableDefinition getTable(SchemaDefinition schema, String name, boolean ignoreCase);

/**
 * Gets a specific table by schema and jOOQ Name
 * @param schema - Schema containing the table
 * @param name - jOOQ Name object for the table
 * @returns Table definition or null if not found
 */
TableDefinition getTable(SchemaDefinition schema, Name name);

/**
 * Gets a specific table by jOOQ Name with case sensitivity control
 * @param schema - Schema containing the table  
 * @param name - jOOQ Name object for the table
 * @param ignoreCase - Whether to ignore case in name matching
 * @returns Table definition or null if not found
 */
TableDefinition getTable(SchemaDefinition schema, Name name, boolean ignoreCase);

Usage Examples:

import org.jooq.meta.Database;
import org.jooq.meta.TableDefinition;
import org.jooq.meta.SchemaDefinition;
import org.jooq.Name;
import org.jooq.impl.DSL;

// Get all tables
List<TableDefinition> allTables = database.getTables();
System.out.println("Total tables: " + allTables.size());

// Get tables in specific schema
SchemaDefinition schema = database.getSchema("public");
List<TableDefinition> schemaTables = database.getTables(schema);

for (TableDefinition table : schemaTables) {
    System.out.println("Table: " + table.getName());
    System.out.println("Type: " + (table.isView() ? "VIEW" : "TABLE"));
    System.out.println("Columns: " + table.getColumns().size());
}

// Get specific table
TableDefinition usersTable = database.getTable(schema, "users");
if (usersTable != null) {
    System.out.println("Found users table with " + usersTable.getColumns().size() + " columns");
}

// Case-insensitive lookup
TableDefinition table = database.getTable(schema, "Users", true);

// Using jOOQ Name
Name tableName = DSL.name("customer_orders");
TableDefinition ordersTable = database.getTable(schema, tableName);

Object Existence Checking

Utility methods for checking existence of database objects before access.

/**
 * Checks if a table field exists in the database
 * @param field - Table field to check
 * @returns true if the field exists
 */
boolean exists(TableField<?, ?> field);

/**
 * Checks if all specified table fields exist
 * @param fields - Array of table fields to check
 * @returns true if all fields exist
 */
boolean existAll(TableField<?, ?>... fields);

/**
 * Checks if a table exists in the database
 * @param table - Table to check
 * @returns true if the table exists
 */
boolean exists(Table<?> table);

/**
 * Checks if all specified tables exist
 * @param tables - Array of tables to check
 * @returns true if all tables exist
 */
boolean existAll(Table<?>... tables);

Schema Navigation and Hierarchy

Methods for navigating the schema hierarchy and understanding object relationships.

/**
 * Gets the definition path for hierarchical navigation
 * @returns List of definitions representing the hierarchy path
 */
List<Definition> getDefinitionPath();

/**
 * Gets qualified name parts for the object
 * @returns jOOQ Name representing qualified name
 */
Name getQualifiedNamePart();

/**
 * Gets all partially qualified names for caching and lookup
 * @returns List of partially qualified name strings
 */
List<String> getPartiallyQualifiedNames();

Types

interface CatalogDefinition extends Definition {
    String getName();
    String getComment();
    Database getDatabase();
}

interface SchemaDefinition extends Definition {
    String getName();
    String getComment();
    CatalogDefinition getCatalog();
    Database getDatabase();
}

interface Definition {
    String getName();
    String getInputName();
    String getOutputName();
    String getComment();
    String getQualifiedName();
    String getQualifiedInputName();
    String getQualifiedOutputName();
    List<Definition> getDefinitionPath();
    Database getDatabase();
    SchemaDefinition getSchema();
    CatalogDefinition getCatalog();
}

Usage Examples:

import org.jooq.meta.Database;
import org.jooq.meta.CatalogDefinition;
import org.jooq.meta.SchemaDefinition; 
import org.jooq.meta.TableDefinition;

// Complete schema discovery
List<CatalogDefinition> catalogs = database.getCatalogs();
for (CatalogDefinition catalog : catalogs) {
    System.out.println("Catalog: " + catalog.getName());
    
    List<SchemaDefinition> schemas = database.getSchemata(catalog);
    for (SchemaDefinition schema : schemas) {
        System.out.println("  Schema: " + schema.getName());
        
        List<TableDefinition> tables = database.getTables(schema);
        for (TableDefinition table : tables) {
            System.out.println("    Table: " + table.getName());
            System.out.println("      Qualified: " + table.getQualifiedName());
            System.out.println("      Comment: " + table.getComment());
        }
    }
}

// Schema hierarchy navigation
TableDefinition table = database.getTable(schema, "orders");
List<Definition> path = table.getDefinitionPath();
// Path: [catalog] -> [schema] -> [table]

Install with Tessl CLI

npx tessl i tessl/maven-org-jooq--jooq-meta

docs

advanced-objects.md

configuration.md

constraints-relationships.md

database-implementations.md

database-management.md

index.md

schema-discovery.md

table-analysis.md

tile.json