Class SqlDdlGenerator

java.lang.Object
org.apache.ignite.migrationtools.sql.SqlDdlGenerator

public class SqlDdlGenerator extends Object
Generates a SQL DDL Script from Ignite 2 Cache Configurations and custom type hints.
  • Field Details

    • EXTRA_FIELDS_COLUMN_NAME

      public static final String EXTRA_FIELDS_COLUMN_NAME
      Name of the column that will be used to store fields that cannot be serialized natively, like nested objects in POJOs.
      See Also:
  • Constructor Details

    • SqlDdlGenerator

      public SqlDdlGenerator()
    • SqlDdlGenerator

      public SqlDdlGenerator(TableTypeRegistry tableTypeRegistry)
    • SqlDdlGenerator

      public SqlDdlGenerator(TableTypeRegistry tableTypeRegistry, boolean allowExtraFields)
    • SqlDdlGenerator

      public SqlDdlGenerator(ClassLoader clientClassLoader, TableTypeRegistry tableTypeRegistry, boolean allowExtraFields)
      Constructor.
      Parameters:
      clientClassLoader - Custom classloader to use.
      tableTypeRegistry - Table type registry implementation to use.
      allowExtraFields - If true, the extra fields column will be added to generated tables.
  • Method Details

    • createDdlQuery

      public static String createDdlQuery(org.apache.ignite3.catalog.definitions.TableDefinition def)
    • createDdlQuery

      public static String createDdlQuery(List<org.apache.ignite3.catalog.definitions.TableDefinition> defs)
      Create SQL DDL Statements from the provided list of table definitions.
      Parameters:
      defs - Table definitions.
      Returns:
      String composed by the SQL DDL Statements.
    • qualifiedName

      public static org.apache.ignite3.table.QualifiedName qualifiedName(org.apache.ignite.configuration.CacheConfiguration<?,?> cacheCfg)
      Computes the cache qualified name from a cache configuration.
      Parameters:
      cacheCfg - Cache configuration.
      Returns:
      Qualified Name.
    • generate

      public SqlDdlGenerator.GenerateTableResult generate(org.apache.ignite.configuration.CacheConfiguration<?,?> cacheCfg) throws FieldNameConflictException
      Generate table based on the provided CacheConfiguration.
      Parameters:
      cacheCfg - The cache configuration.
      Returns:
      The generate table result.
      Throws:
      FieldNameConflictException - in case of conflicts during the mapping.
    • generateTableDefinition

      public org.apache.ignite3.catalog.definitions.TableDefinition generateTableDefinition(org.apache.ignite.configuration.CacheConfiguration<?,?> cacheCfg) throws FieldNameConflictException
      Throws:
      FieldNameConflictException