Package com.exasol.dbbuilder
Class Schema
- java.lang.Object
-
- com.exasol.dbbuilder.AbstractDatabaseObject
-
- com.exasol.dbbuilder.Schema
-
- All Implemented Interfaces:
DatabaseObject
public class Schema extends AbstractDatabaseObject
Database schema.
-
-
Field Summary
-
Fields inherited from class com.exasol.dbbuilder.AbstractDatabaseObject
name, writer
-
-
Constructor Summary
Constructors Constructor Description Schema(DatabaseObjectWriter writer, String name)Create a new database schema.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdapterScriptcreateAdapterScript(String name, AdapterScript.Language language, String content)Create an adapter script.ScriptcreateScript(String name, String content, String... parameterNames)Create a script that does not return anything.ScriptcreateScript(String name, Path path, String... parameterNames)Create a script and load its implementation from a file.Script.BuildercreateScriptBuilder(String name)Create a builder for a database script.TablecreateTable(String name, String column1Name, String column1Type)Create a table with one column.TablecreateTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)Create a table with two columns.TablecreateTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)Create a table with three columns.TablecreateTable(String name, List<String> columnNames, List<String> columnTypes)Create a table with an arbitrary number of columns.Table.BuildercreateTableBuilder(String name)Create a builder for a table.DatabaseObjectgetParent()Get the parent object.List<Table>getTables()Get the tables inside this schema.StringgetType()Get the type of the database object.booleanhasParent()Check if this object has a parent object that sets the scope within the database-
Methods inherited from class com.exasol.dbbuilder.AbstractDatabaseObject
getFullyQualifiedName, getName
-
-
-
-
Constructor Detail
-
Schema
public Schema(DatabaseObjectWriter writer, String name)
Create a new database schema.- Parameters:
writer- database object writername- name of the database schema
-
-
Method Detail
-
getType
public String getType()
Description copied from interface:DatabaseObjectGet the type of the database object.- Returns:
- type of the database object
-
hasParent
public boolean hasParent()
Description copied from interface:DatabaseObjectCheck if this object has a parent object that sets the scope within the database- Returns:
trueif the object has a parent
-
getParent
public DatabaseObject getParent()
Description copied from interface:DatabaseObjectGet the parent object.- Returns:
- parent object
-
getTables
public List<Table> getTables()
Get the tables inside this schema.- Returns:
- list of tables in this schema
-
createAdapterScript
public AdapterScript createAdapterScript(String name, AdapterScript.Language language, String content)
Create an adapter script.- Parameters:
name- name of the adapter scriptlanguage- language the adapter script is implemented incontent- implementation of the script- Returns:
- adapter script
-
createTableBuilder
public Table.Builder createTableBuilder(String name)
Create a builder for a table.In cases where you need a more complex table than can be created by the convenience methods
createTable, this method provides a builder.- Parameters:
name- table name- Returns:
- builder for the table
-
createTable
public Table createTable(String name, List<String> columnNames, List<String> columnTypes)
Create a table with an arbitrary number of columns.- Parameters:
name- name of the tablecolumnNames- list of column namescolumnTypes- list of column types- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type)
Create a table with one column.- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type)
Create a table with two columns.- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first columncolumn2Name- name of the second columncolumn2Type- type of the second column- Returns:
- table
-
createTable
public Table createTable(String name, String column1Name, String column1Type, String column2Name, String column2Type, String column3Name, String column3Type)
Create a table with three columns.- Parameters:
name- name of the tablecolumn1Name- name of the first columncolumn1Type- type of the first columncolumn2Name- name of the second columncolumn2Type- type of the second columncolumn3Name- name of the third columncolumn3Type- type of the third column- Returns:
- table
-
createScript
public Script createScript(String name, String content, String... parameterNames)
Create a script that does not return anything.- Parameters:
name- name of the scriptcontent- implementation of the scriptparameterNames- names of the parameters of the script- Returns:
- script
-
createScript
public Script createScript(String name, Path path, String... parameterNames)
Create a script and load its implementation from a file.- Parameters:
name- name of the scriptpath- path to file containing the script implementationparameterNames- names of the parameters of the script- Returns:
- script
-
createScriptBuilder
public Script.Builder createScriptBuilder(String name)
Create a builder for a database script.- Parameters:
name- name of the script- Returns:
- builder
-
-