Interface NCSqlTable


  • public interface NCSqlTable
    Object presentation of SQL table.

    In JSON/YAML generated model the table is the model element (example):

       elements:
         - id: "tbl:orders"
           groups:
           - "table"
           synonyms:
           - "orders"
           metadata:
             sql:name: "orders"
             sql:defaultselect:
             - "order_id"
             - "order_date"
             - "required_date"
             sql:defaultsort:
             - "orders.order_id#desc"
             sql:extratables:
             - "customers"
             - "shippers"
             - "employees"
             sql:defaultdate: "orders.order_date"
           description: "Auto-generated from 'orders' table."
     
    Few notes:
    • All model elements representing SQL column have ID in a form of tbl:sql_table_name.
    • All model elements representing SQL column belong to table group.
    • These model elements have auto-generated synonyms and set of mandatory metadata.
    • User can freely add group membership, change synonyms, or add new metadata.
    See Also:
    NCSqlSchemaBuilder.makeSchema(NCModel), NCSqlExtractorBuilder.build(NCSqlSchema, NCVariant), NCSqlExtractor.extractTable(NCToken), NCSqlSchema.getTables()
    • Method Detail

      • getTable

        String getTable()
        Gets table name.

        In JSON/YAML generated model the table name is declared with the following element metadata (example):

              sql:name: "orders"
         
        Note also that all elements declaring SQL tables belong to table group.
        Returns:
        table name.
      • getColumns

        List<NCSqlColumn> getColumns()
        Gets collections of this table columns.
        Returns:
        Collections of this table columns.
      • getDefaultSort

        List<NCSqlSort> getDefaultSort()
        Gets default sort descriptor.

        In JSON/YAML generated model the default sort list is declared with the following element metadata (example):

             sql:defaultsort:
             - "orders.order_id#desc"
         
        Note the table.column#{asc|desc} notation for identifying table name, column name and the sort order.
        Returns:
        Default sort descriptor.
      • getDefaultSelect

        List<String> getDefaultSelect()
        Gets the list of the column names for the default select set.

        In JSON/YAML generated model the default select list is declared with the following element metadata (example):

             sql:defaultselect:
             - "order_id"
             - "order_date"
             - "required_date"
         
        Returns:
        List of the column names for the default select set.
      • getExtraTables

        List<String> getExtraTables()
        Gets the list of extra tables this table is referencing. Extra tables are joined together with this table for default selection. Often, a single domain dataset if spread over multiple tables and this allows to have a meaningful default selection.

        In JSON/YAML generated model the extra tables list is declared with the following element metadata (example):

             sql:extratables:
             - "other_part_table"
             - "another_part_table"
         
        Returns:
        List of extra tables this table's default selection.
      • getDefaultDate

        Optional<NCSqlColumn> getDefaultDate()
        Gets a column that defines a default date for this table. Note that this column can belong to another table.

        In JSON/YAML generated model the default date column is declared with the following element metadata (example):

             sql:defaultdate: "orders.order_date"
         
        Note table.column notation for the table and column names.
        Returns:
        Column that defines a default date for this table.