Class SqlDdlGenerator
java.lang.Object
org.apache.ignite.migrationtools.sql.SqlDdlGenerator
Generates a SQL DDL Script from Ignite 2 Cache Configurations and custom type hints.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classGenerateTableResult. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the column that will be used to store fields that cannot be serialized natively, like nested objects in POJOs. -
Constructor Summary
ConstructorsConstructorDescriptionSqlDdlGenerator(ClassLoader clientClassLoader, TableTypeRegistry tableTypeRegistry, boolean allowExtraFields) Constructor.SqlDdlGenerator(TableTypeRegistry tableTypeRegistry) SqlDdlGenerator(TableTypeRegistry tableTypeRegistry, boolean allowExtraFields) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateDdlQuery(List<org.apache.ignite3.catalog.definitions.TableDefinition> defs) Create SQL DDL Statements from the provided list of table definitions.static StringcreateDdlQuery(org.apache.ignite3.catalog.definitions.TableDefinition def) generate(org.apache.ignite.configuration.CacheConfiguration<?, ?> cacheCfg) Generate table based on the providedCacheConfiguration.org.apache.ignite3.catalog.definitions.TableDefinitiongenerateTableDefinition(org.apache.ignite.configuration.CacheConfiguration<?, ?> cacheCfg) static org.apache.ignite3.table.QualifiedNamequalifiedName(org.apache.ignite.configuration.CacheConfiguration<?, ?> cacheCfg) Computes the cache qualified name from a cache configuration.
-
Field Details
-
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
-
SqlDdlGenerator
-
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
-
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 FieldNameConflictExceptionGenerate table based on the providedCacheConfiguration.- 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
-