schema_sentinel.metadata_manager.enums API documentation

# schema_sentinel.metadata_manager.enums

View Source

      1from dataclasses import dataclass
      2from enum import Enum
      3
      4
      5class ChangeSetUpdateAction(Enum):
      6    IGNORE = 0
      7    EXECUTE = 1
      8    ERROR = 2
      9    ASK = 3
     10
     11
     12class ExceptionAction(Enum):
     13    RAISE = 0
     14    CONTINUE = 1
     15    ASK = 2
     16
     17
     18class ConnectMode(Enum):
     19    SSO = 0
     20    PWD = 1
     21    KEY_PAIR = 2
     22
     23
     24class StreamSourceType(Enum):
     25    TABLE = 0
     26    VIEW = 1
     27
     28
     29class StreamMode(Enum):
     30    APPEND_ONLY = 0
     31    INSERT_ONLY = 1
     32
     33
     34class DbObjectType(Enum):
     35    DATABASE = ("database",)
     36    SCHEMA = ("schema",)
     37    STAGE = ("stage",)
     38    TABLE = ("table",)
     39    VIEW = ("view",)
     40    COLUMN = ("column",)
     41    PRIMARY_KEY = ("primary key",)
     42    UNIQUE_KEY = ("unique key",)
     43    FOREIGN_KEY = ("foreign key",)
     44    PROCEDURE = ("procedure",)
     45    FUNCTION = ("function",)
     46    STREAM = ("stream",)
     47    PIPE = ("pipe",)
     48    TASK = ("task",)
     49    PARAMETER = "parameter"
     50
     51
     52class DbFolderType(Enum):
     53    DATABASE = ((DbObjectType.DATABASE, "01"),)
     54    SCHEMA = ((DbObjectType.SCHEMA, "02"),)
     55    STAGE = ((DbObjectType.STAGE, "04"),)
     56    TABLE = ((DbObjectType.TABLE, "05"),)
     57    VIEW = ((DbObjectType.VIEW, "06"),)
     58    STREAM = ((DbObjectType.STREAM, "07"),)
     59    TASK = ((DbObjectType.TASK, "08"),)
     60    PROCEDURE = (DbObjectType.PROCEDURE, "09")
     61
     62
     63@dataclass
     64class Message:
     65    subject: str
     66    text: str
     67
     68
     69@dataclass
     70class DiffCategoryItem:
     71    id: int
     72    name: str
     73    message: Message
     74
     75
     76DATA_RETENTION_TIME_IN_DAYS = 7
     77
     78
     79class DbObjectType(Enum):
     80    DATABASE = "database"
     81    SCHEMA = "schema"
     82    TABLE = "table"
     83    COLUMN = "column"
     84    TABLE_CONSTRAINT = "table_constraint"
     85    COLUMN_CONSTRAINT = "column_constraint"
     86    REFERENTIAL_CONSTRAINT = "referential_constraint"
     87    VIEW = "view"
     88    PIPE = "pipe"
     89    STAGE = "stage"
     90    STREAM = "stream"
     91    TASK = "task"
     92    PROCEDURE = "procedure"
     93    FUNCTION = "function"
     94    CONSTRAINT = "constraint"
     95
     96    @staticmethod
     97    def list():
     98        return [e.value for e in DbObjectType]
     99
    100
    101class Environment(Enum):
    102    DEV = "dev"
    103    NON_PROD = "non_prod"
    104    CERT = "cert"
    105    PROD = "prod"
    106
    107    @staticmethod
    108    def list():
    109        return [e.value for e in Environment]
    110
    111
    112class ConstraintType(Enum):
    113    PRIMARY_KEY = "primary key"
    114    UNIQUE_KEY = "unique"
    115    FOREIGN_KEY = "foreign key"
    116
    117    @staticmethod
    118    def list():
    119        return [e.value for e in ConstraintType]
    120
    121
    122class StageType(Enum):
    123    INTERNAL_NAMED = "internal named"
    124    EXTERNAL_NAMED = "external named"
    125
    126
    127class DiffCategory(Enum):
    128    TYPE = (
    129        DiffCategoryItem(
    130            0,
    131            "object type",
    132            Message(subject="object type", text="{} object {} is different from {}"),
    133        ),
    134    )
    135    NAME = (
    136        DiffCategoryItem(
    137            1,
    138            "object name",
    139            Message(subject="object name", text="{} object {} is not in the list {}"),
    140        ),
    141    )
    142    COMMENT = (
    143        DiffCategoryItem(
    144            2,
    145            "object comment",
    146            Message(subject="object comment", text="{} object {} is different from {}"),
    147        ),
    148    )
    149    QUOTED_IDENTIFIER = (
    150        DiffCategoryItem(
    151            3,
    152            "quoted identifier",
    153            Message(subject="object comment", text="{} object {} is different from {}"),
    154        ),
    155    )
    156    DATABASE_SCHEMAS = (
    157        DiffCategoryItem(
    158            4,
    159            "database schemas",
    160            Message(subject="object comment", text="{} object {} is different from {}"),
    161        ),
    162    )
    163    SCHEMA_TABLES = (
    164        DiffCategoryItem(
    165            5,
    166            "schema tables",
    167            Message(subject="object comment", text="{} object {} is different from {}"),
    168        ),
    169    )
    170    TABLE_COLUMNS = (
    171        DiffCategoryItem(
    172            6,
    173            "table columns",
    174            Message(subject="object comment", text="{} object {} is different from {}"),
    175        ),
    176    )
    177    PARAMETERS = (
    178        DiffCategoryItem(
    179            6,
    180            "parameters",
    181            Message(subject="object comment", text="{} object {} is different from {}"),
    182        ),
    183    )
    184    PRIMARY_KEY = (
    185        DiffCategoryItem(
    186            7,
    187            "primary key",
    188            Message(subject="object comment", text="{} object {} is different from {}"),
    189        ),
    190    )
    191    UNIQUE_KEYS = (
    192        DiffCategoryItem(
    193            8,
    194            "unique keys",
    195            Message(subject="object comment", text="{} object {} is different from {}"),
    196        ),
    197    )
    198    FOREIGN_KEYS = (
    199        DiffCategoryItem(
    200            9,
    201            "foreign keys",
    202            Message(subject="object comment", text="{} object {} is different from {}"),
    203        ),
    204    )
    205    COLUMN_DATA_TYPE = (
    206        DiffCategoryItem(
    207            10,
    208            "column data type",
    209            Message(subject="object comment", text="{} object {} is different from {}"),
    210        ),
    211    )
    212    NUMBER_SCALE = (
    213        DiffCategoryItem(
    214            10,
    215            "number scale",
    216            Message(subject="object comment", text="{} object {} is different from {}"),
    217        ),
    218    )
    219    NUMBER_PRECISION = (
    220        DiffCategoryItem(
    221            11,
    222            "number precision",
    223            Message(subject="object comment", text="{} object {} is different from {}"),
    224        ),
    225    )
    226    DATA_LENGTH = (
    227        DiffCategoryItem(
    228            12,
    229            "column length",
    230            Message(subject="object comment", text="{} object {} is different from {}"),
    231        ),
    232    )
    233    COLUMN_NULLABLE = (
    234        DiffCategoryItem(
    235            13,
    236            "is nullable",
    237            Message(subject="object comment", text="{} object {} is different from {}"),
    238        ),
    239    )
    240    COLUMN_DEFAULT = (
    241        DiffCategoryItem(
    242            14,
    243            "column default",
    244            Message(subject="object comment", text="{} object {} is different from {}"),
    245        ),
    246    )
    247    COLUMN_UNIQUE = (
    248        DiffCategoryItem(
    249            15,
    250            "is unique",
    251            Message(subject="object comment", text="{} object {} is different from {}"),
    252        ),
    253    )
    254    COLUMN_IS_PK = (
    255        DiffCategoryItem(
    256            16,
    257            "is in primary key",
    258            Message(subject="object comment", text="{} object {} is different from {}"),
    259        ),
    260    )
    261    COLUMN_FOREIGN_KEY = DiffCategoryItem(
    262        17,
    263        "column is not in foreign key",
    264        Message(
    265            subject="column is not in foreign key",
    266            text="{} object {} is different from {}",
    267        ),
    268    )

class ChangeSetUpdateAction(enum.Enum): View Source

     6class ChangeSetUpdateAction(Enum):
     7    IGNORE = 0
     8    EXECUTE = 1
     9    ERROR = 2
    10    ASK = 3

IGNORE = <ChangeSetUpdateAction.IGNORE: 0>
EXECUTE = <ChangeSetUpdateAction.EXECUTE: 1>
ERROR = <ChangeSetUpdateAction.ERROR: 2>
ASK = <ChangeSetUpdateAction.ASK: 3>
class ExceptionAction(enum.Enum): View Source

    13class ExceptionAction(Enum):
    14    RAISE = 0
    15    CONTINUE = 1
    16    ASK = 2

RAISE = <ExceptionAction.RAISE: 0>
CONTINUE = <ExceptionAction.CONTINUE: 1>
ASK = <ExceptionAction.ASK: 2>
class ConnectMode(enum.Enum): View Source

    19class ConnectMode(Enum):
    20    SSO = 0
    21    PWD = 1
    22    KEY_PAIR = 2

SSO = <ConnectMode.SSO: 0>
PWD = <ConnectMode.PWD: 1>
KEY_PAIR = <ConnectMode.KEY_PAIR: 2>
class StreamSourceType(enum.Enum): View Source

    25class StreamSourceType(Enum):
    26    TABLE = 0
    27    VIEW = 1

TABLE = <StreamSourceType.TABLE: 0>
VIEW = <StreamSourceType.VIEW: 1>
class StreamMode(enum.Enum): View Source

    30class StreamMode(Enum):
    31    APPEND_ONLY = 0
    32    INSERT_ONLY = 1

APPEND_ONLY = <StreamMode.APPEND_ONLY: 0>
INSERT_ONLY = <StreamMode.INSERT_ONLY: 1>
class DbObjectType(enum.Enum): View Source

    80class DbObjectType(Enum):
    81    DATABASE = "database"
    82    SCHEMA = "schema"
    83    TABLE = "table"
    84    COLUMN = "column"
    85    TABLE_CONSTRAINT = "table_constraint"
    86    COLUMN_CONSTRAINT = "column_constraint"
    87    REFERENTIAL_CONSTRAINT = "referential_constraint"
    88    VIEW = "view"
    89    PIPE = "pipe"
    90    STAGE = "stage"
    91    STREAM = "stream"
    92    TASK = "task"
    93    PROCEDURE = "procedure"
    94    FUNCTION = "function"
    95    CONSTRAINT = "constraint"
    96
    97    @staticmethod
    98    def list():
    99        return [e.value for e in DbObjectType]

DATABASE = <DbObjectType.DATABASE: 'database'>
SCHEMA = <DbObjectType.SCHEMA: 'schema'>
TABLE = <DbObjectType.TABLE: 'table'>
COLUMN = <DbObjectType.COLUMN: 'column'>
TABLE_CONSTRAINT = <DbObjectType.TABLE_CONSTRAINT: 'table_constraint'>
COLUMN_CONSTRAINT = <DbObjectType.COLUMN_CONSTRAINT: 'column_constraint'>
REFERENTIAL_CONSTRAINT = <DbObjectType.REFERENTIAL_CONSTRAINT: 'referential_constraint'>
VIEW = <DbObjectType.VIEW: 'view'>
PIPE = <DbObjectType.PIPE: 'pipe'>
STAGE = <DbObjectType.STAGE: 'stage'>
STREAM = <DbObjectType.STREAM: 'stream'>
TASK = <DbObjectType.TASK: 'task'>
PROCEDURE = <DbObjectType.PROCEDURE: 'procedure'>
FUNCTION = <DbObjectType.FUNCTION: 'function'>
CONSTRAINT = <DbObjectType.CONSTRAINT: 'constraint'>
@staticmethod
def list(): View Source

    97    @staticmethod
    98    def list():
    99        return [e.value for e in DbObjectType]

class DbFolderType(enum.Enum): View Source

    53class DbFolderType(Enum):
    54    DATABASE = ((DbObjectType.DATABASE, "01"),)
    55    SCHEMA = ((DbObjectType.SCHEMA, "02"),)
    56    STAGE = ((DbObjectType.STAGE, "04"),)
    57    TABLE = ((DbObjectType.TABLE, "05"),)
    58    VIEW = ((DbObjectType.VIEW, "06"),)
    59    STREAM = ((DbObjectType.STREAM, "07"),)
    60    TASK = ((DbObjectType.TASK, "08"),)
    61    PROCEDURE = (DbObjectType.PROCEDURE, "09")

DATABASE = <DbFolderType.DATABASE: ((<DbObjectType.DATABASE: ('database',)>, '01'),)>
SCHEMA = <DbFolderType.SCHEMA: ((<DbObjectType.SCHEMA: ('schema',)>, '02'),)>
STAGE = <DbFolderType.STAGE: ((<DbObjectType.STAGE: ('stage',)>, '04'),)>
TABLE = <DbFolderType.TABLE: ((<DbObjectType.TABLE: ('table',)>, '05'),)>
VIEW = <DbFolderType.VIEW: ((<DbObjectType.VIEW: ('view',)>, '06'),)>
STREAM = <DbFolderType.STREAM: ((<DbObjectType.STREAM: ('stream',)>, '07'),)>
TASK = <DbFolderType.TASK: ((<DbObjectType.TASK: ('task',)>, '08'),)>
PROCEDURE = <DbFolderType.PROCEDURE: (<DbObjectType.PROCEDURE: ('procedure',)>, '09')>
@dataclass
class Message: View Source

    64@dataclass
    65class Message:
    66    subject: str
    67    text: str

Message(subject: str, text: str)
subject: str
text: str
@dataclass
class DiffCategoryItem: View Source

    70@dataclass
    71class DiffCategoryItem:
    72    id: int
    73    name: str
    74    message: Message

DiffCategoryItem( id: int, name: str, message: Message)
id: int
name: str
message: Message
DATA_RETENTION_TIME_IN_DAYS = 7
class Environment(enum.Enum): View Source

    102class Environment(Enum):
    103    DEV = "dev"
    104    NON_PROD = "non_prod"
    105    CERT = "cert"
    106    PROD = "prod"
    107
    108    @staticmethod
    109    def list():
    110        return [e.value for e in Environment]

DEV = <Environment.DEV: 'dev'>
NON_PROD = <Environment.NON_PROD: 'non_prod'>
CERT = <Environment.CERT: 'cert'>
PROD = <Environment.PROD: 'prod'>
@staticmethod
def list(): View Source

    108    @staticmethod
    109    def list():
    110        return [e.value for e in Environment]

class ConstraintType(enum.Enum): View Source

    113class ConstraintType(Enum):
    114    PRIMARY_KEY = "primary key"
    115    UNIQUE_KEY = "unique"
    116    FOREIGN_KEY = "foreign key"
    117
    118    @staticmethod
    119    def list():
    120        return [e.value for e in ConstraintType]

PRIMARY_KEY = <ConstraintType.PRIMARY_KEY: 'primary key'>
UNIQUE_KEY = <ConstraintType.UNIQUE_KEY: 'unique'>
FOREIGN_KEY = <ConstraintType.FOREIGN_KEY: 'foreign key'>
@staticmethod
def list(): View Source

    118    @staticmethod
    119    def list():
    120        return [e.value for e in ConstraintType]

class StageType(enum.Enum): View Source

    123class StageType(Enum):
    124    INTERNAL_NAMED = "internal named"
    125    EXTERNAL_NAMED = "external named"

INTERNAL_NAMED = <StageType.INTERNAL_NAMED: 'internal named'>
EXTERNAL_NAMED = <StageType.EXTERNAL_NAMED: 'external named'>
class DiffCategory(enum.Enum): View Source

    128class DiffCategory(Enum):
    129    TYPE = (
    130        DiffCategoryItem(
    131            0,
    132            "object type",
    133            Message(subject="object type", text="{} object {} is different from {}"),
    134        ),
    135    )
    136    NAME = (
    137        DiffCategoryItem(
    138            1,
    139            "object name",
    140            Message(subject="object name", text="{} object {} is not in the list {}"),
    141        ),
    142    )
    143    COMMENT = (
    144        DiffCategoryItem(
    145            2,
    146            "object comment",
    147            Message(subject="object comment", text="{} object {} is different from {}"),
    148        ),
    149    )
    150    QUOTED_IDENTIFIER = (
    151        DiffCategoryItem(
    152            3,
    153            "quoted identifier",
    154            Message(subject="object comment", text="{} object {} is different from {}"),
    155        ),
    156    )
    157    DATABASE_SCHEMAS = (
    158        DiffCategoryItem(
    159            4,
    160            "database schemas",
    161            Message(subject="object comment", text="{} object {} is different from {}"),
    162        ),
    163    )
    164    SCHEMA_TABLES = (
    165        DiffCategoryItem(
    166            5,
    167            "schema tables",
    168            Message(subject="object comment", text="{} object {} is different from {}"),
    169        ),
    170    )
    171    TABLE_COLUMNS = (
    172        DiffCategoryItem(
    173            6,
    174            "table columns",
    175            Message(subject="object comment", text="{} object {} is different from {}"),
    176        ),
    177    )
    178    PARAMETERS = (
    179        DiffCategoryItem(
    180            6,
    181            "parameters",
    182            Message(subject="object comment", text="{} object {} is different from {}"),
    183        ),
    184    )
    185    PRIMARY_KEY = (
    186        DiffCategoryItem(
    187            7,
    188            "primary key",
    189            Message(subject="object comment", text="{} object {} is different from {}"),
    190        ),
    191    )
    192    UNIQUE_KEYS = (
    193        DiffCategoryItem(
    194            8,
    195            "unique keys",
    196            Message(subject="object comment", text="{} object {} is different from {}"),
    197        ),
    198    )
    199    FOREIGN_KEYS = (
    200        DiffCategoryItem(
    201            9,
    202            "foreign keys",
    203            Message(subject="object comment", text="{} object {} is different from {}"),
    204        ),
    205    )
    206    COLUMN_DATA_TYPE = (
    207        DiffCategoryItem(
    208            10,
    209            "column data type",
    210            Message(subject="object comment", text="{} object {} is different from {}"),
    211        ),
    212    )
    213    NUMBER_SCALE = (
    214        DiffCategoryItem(
    215            10,
    216            "number scale",
    217            Message(subject="object comment", text="{} object {} is different from {}"),
    218        ),
    219    )
    220    NUMBER_PRECISION = (
    221        DiffCategoryItem(
    222            11,
    223            "number precision",
    224            Message(subject="object comment", text="{} object {} is different from {}"),
    225        ),
    226    )
    227    DATA_LENGTH = (
    228        DiffCategoryItem(
    229            12,
    230            "column length",
    231            Message(subject="object comment", text="{} object {} is different from {}"),
    232        ),
    233    )
    234    COLUMN_NULLABLE = (
    235        DiffCategoryItem(
    236            13,
    237            "is nullable",
    238            Message(subject="object comment", text="{} object {} is different from {}"),
    239        ),
    240    )
    241    COLUMN_DEFAULT = (
    242        DiffCategoryItem(
    243            14,
    244            "column default",
    245            Message(subject="object comment", text="{} object {} is different from {}"),
    246        ),
    247    )
    248    COLUMN_UNIQUE = (
    249        DiffCategoryItem(
    250            15,
    251            "is unique",
    252            Message(subject="object comment", text="{} object {} is different from {}"),
    253        ),
    254    )
    255    COLUMN_IS_PK = (
    256        DiffCategoryItem(
    257            16,
    258            "is in primary key",
    259            Message(subject="object comment", text="{} object {} is different from {}"),
    260        ),
    261    )
    262    COLUMN_FOREIGN_KEY = DiffCategoryItem(
    263        17,
    264        "column is not in foreign key",
    265        Message(
    266            subject="column is not in foreign key",
    267            text="{} object {} is different from {}",
    268        ),
    269    )

TYPE = <DiffCategory.TYPE: (DiffCategoryItem(id=0, name='object type', message=Message(subject='object type', text='{} object {} is different from {}')),)>
NAME = <DiffCategory.NAME: (DiffCategoryItem(id=1, name='object name', message=Message(subject='object name', text='{} object {} is not in the list {}')),)>
COMMENT = <DiffCategory.COMMENT: (DiffCategoryItem(id=2, name='object comment', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
QUOTED_IDENTIFIER = <DiffCategory.QUOTED_IDENTIFIER: (DiffCategoryItem(id=3, name='quoted identifier', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
DATABASE_SCHEMAS = <DiffCategory.DATABASE_SCHEMAS: (DiffCategoryItem(id=4, name='database schemas', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
SCHEMA_TABLES = <DiffCategory.SCHEMA_TABLES: (DiffCategoryItem(id=5, name='schema tables', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
TABLE_COLUMNS = <DiffCategory.TABLE_COLUMNS: (DiffCategoryItem(id=6, name='table columns', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
PARAMETERS = <DiffCategory.PARAMETERS: (DiffCategoryItem(id=6, name='parameters', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
PRIMARY_KEY = <DiffCategory.PRIMARY_KEY: (DiffCategoryItem(id=7, name='primary key', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
UNIQUE_KEYS = <DiffCategory.UNIQUE_KEYS: (DiffCategoryItem(id=8, name='unique keys', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
FOREIGN_KEYS = <DiffCategory.FOREIGN_KEYS: (DiffCategoryItem(id=9, name='foreign keys', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_DATA_TYPE = <DiffCategory.COLUMN_DATA_TYPE: (DiffCategoryItem(id=10, name='column data type', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
NUMBER_SCALE = <DiffCategory.NUMBER_SCALE: (DiffCategoryItem(id=10, name='number scale', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
NUMBER_PRECISION = <DiffCategory.NUMBER_PRECISION: (DiffCategoryItem(id=11, name='number precision', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
DATA_LENGTH = <DiffCategory.DATA_LENGTH: (DiffCategoryItem(id=12, name='column length', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_NULLABLE = <DiffCategory.COLUMN_NULLABLE: (DiffCategoryItem(id=13, name='is nullable', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_DEFAULT = <DiffCategory.COLUMN_DEFAULT: (DiffCategoryItem(id=14, name='column default', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_UNIQUE = <DiffCategory.COLUMN_UNIQUE: (DiffCategoryItem(id=15, name='is unique', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_IS_PK = <DiffCategory.COLUMN_IS_PK: (DiffCategoryItem(id=16, name='is in primary key', message=Message(subject='object comment', text='{} object {} is different from {}')),)>
COLUMN_FOREIGN_KEY = <DiffCategory.COLUMN_FOREIGN_KEY: DiffCategoryItem(id=17, name='column is not in foreign key', message=Message(subject='column is not in foreign key', text='{} object {} is different from {}'))>