docs.Schema_puml - V

type: V ( view ), modify_date: 2021-11-10 09:58:43

RepoObject_guid: 0B60D8EE-E90A-EC11-8516-A81E8446D5B0

Description

Examples

Entity Diagram

entity-docs.schema_puml

Columns

Table 1. Columns of docs.Schema_puml - V
PK Column Name Data Type NULL? ID

1

uniqueidentifier

NOT NULL

2

nvarchar(10)

NULL

bit

NOT NULL

nvarchar(max)

NOT NULL

nvarchar(max)

NOT NULL

nvarchar(max)

NULL

nvarchar(128)

NOT NULL

Foreign Key Diagram

entity_1_1_fk-docs.schema_puml

References

Object Reference Diagram - 1 1

entity_1_1_objectref-docs.schema_puml

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-docs.schema_puml

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-docs.schema_puml

Column Reference Diagram

entity_1_1_colref-docs.schema_puml

Indexes

PK_Schema_puml

idx_Schema_puml__1

idx_Schema_puml__2

Column Details

_

RepoSchema_guid

1

RepoSchema_guid

uniqueidentifier

NOT NULL

Referenced Columns

cultures_name

2

cultures_name

nvarchar(10)

NULL

is_ssas

is_ssas

bit

NOT NULL

Referenced Columns

PumlSchemaEr

PumlSchemaEr

nvarchar(max)

NOT NULL

PumlSchemaIndexEr

PumlSchemaIndexEr

nvarchar(max)

NOT NULL

PumlSchemaSsasEr

PumlSchemaSsasEr

nvarchar(max)

NULL

RepoSchema_name

RepoSchema_name

nvarchar(128)

NOT NULL

Referenced Columns

sql_modules_definition

docs.Schema_puml - V script
/*
all objects of a schema

currently only usable: PumlSchemaSsasEr
because in ssas tabular there are no composed keys in relations
*/
CREATE View docs.Schema_puml
As
Select
    rs.RepoSchema_guid
  , schema_culture.cultures_name
  , rs.RepoSchema_name
  , rs.is_ssas
  --todo, how to draw relations between composed keys?
  , PumlSchemaEr      =
  --
  Concat (
             '@startuml' + Char ( 13 ) + Char ( 10 )
           , docs.fs_PumlHeaderLeftToRight ()
           , sel.EntityList_PumlOnlyPkOrIndex
           , Char ( 13 ) + Char ( 10 )
           , Char ( 13 ) + Char ( 10 )
           ----we still need an idea, how to show releations containing composite keys
           --, ssas_rl.SsasRelationList_PumlRelation
           --, Char ( 13 ) + Char ( 10 )
           --, Char ( 13 ) + Char ( 10 )
           , Char ( 13 ) + Char ( 10 ) + Char ( 13 ) + Char ( 10 ) + puml_footer.Parameter_value_result + Char ( 13 )
             + Char ( 10 )
           , Char ( 13 ) + Char ( 10 ) + '@enduml' + Char ( 13 ) + Char ( 10 )
         )
  --it doesn't look very nice, we need wait for a solution to draw PumlSchemaEr
  , PumlSchemaIndexEr =
  --
  Concat (
             '@startuml' + Char ( 13 ) + Char ( 10 )
           , docs.fs_PumlHeaderLeftToRight ()
           , sel.EntityList_PumlOnlyIndex
           , Char ( 13 ) + Char ( 10 )
           , Char ( 13 ) + Char ( 10 )
           , fklist.PumlPartial_FkRefList
           , Char ( 13 ) + Char ( 10 )
           , Char ( 13 ) + Char ( 10 ) + Char ( 13 ) + Char ( 10 ) + puml_footer.Parameter_value_result + Char ( 13 )
             + Char ( 10 )
           , Char ( 13 ) + Char ( 10 ) + '@enduml' + Char ( 13 ) + Char ( 10 )
         )
  , PumlSchemaSsasEr  =
  --
  Case
      When rs.is_ssas = 1
          Then
          Concat (
                     '@startuml' + Char ( 13 ) + Char ( 10 )
                   , docs.fs_PumlHeaderLeftToRight ()
                   , sel.EntityList_PumlOnlyPkOrIndexOrMeasure
                   , Char ( 13 ) + Char ( 10 )
                   , Char ( 13 ) + Char ( 10 )
                   , ssas_rl.SsasRelationList_PumlRelation
                   , Char ( 13 ) + Char ( 10 )
                   , Char ( 13 ) + Char ( 10 ) + Char ( 13 ) + Char ( 10 ) + puml_footer.Parameter_value_result
                     + Char ( 13 ) + Char ( 10 )
                   , Char ( 13 ) + Char ( 10 ) + '@enduml' + Char ( 13 ) + Char ( 10 )
                 )
  End
From
    repo.RepoSchema                                                          As rs
    Left Join
    (
        Select
            Distinct
            RepoObject_schema_name
          , cultures_name
        From
            docs.RepoObject_OutputFilter_T
        Where
            is_ssas = 1
    )                                                                        As schema_culture
        On
        schema_culture.RepoObject_schema_name = rs.RepoSchema_name

    Left Join
        docs.Schema_EntityList                                               As sel
            On
            sel.RepoObject_schema_name = schema_culture.RepoObject_schema_name
            And sel.cultures_name = schema_culture.cultures_name

    Left Join
        docs.Schema_PumlPartial_FkRefList                                    As fklist
            On
            fklist.SchemaName = schema_culture.RepoObject_schema_name
            And fklist.cultures_name = schema_culture.cultures_name

    Left Join
        docs.Schema_SsasRelationList                                         As ssas_rl
            On
            ssas_rl.SchemaName = schema_culture.RepoObject_schema_name
            And ssas_rl.cultures_name = schema_culture.cultures_name
    Cross Join config.ftv_get_parameter_value ( 'puml_skinparam_class', '' ) As skin
    Cross Join config.ftv_get_parameter_value ( 'puml_footer', 'interactive' ) As puml_footer
Where
    Not schema_culture.cultures_name Is Null