Index
            Catalog
  
      dataclass
  
¶
    
            Column
¶
    
              Bases: BaseModel
Represents a Column of a Table.
Source code in src/cloe_nessy/models/column.py
                
            _validate_generated_and_default_value(v)
¶
    Check if a column has a default value and is generated.
That doesn't make sense, so an error should be raised.
Source code in src/cloe_nessy/models/column.py
              
            data_type_transform(raw)
¶
    Map potential aliases to the correct SQL data type.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| raw | str | The value for the data type. | required | 
Source code in src/cloe_nessy/models/column.py
              
            Constraint
¶
    
            ForeignKey
¶
    
              Bases: BaseModel
Represents a ForeignKey.
Source code in src/cloe_nessy/models/foreign_key.py
                
            Schema
¶
    
              Bases: ReadInstancesMixin
A Class to represent a Schema in Unity Catalog.
Source code in src/cloe_nessy/models/schema.py
                
            add_table(table)
¶
    Adds a table to the schema and sets the table identifier accordingly.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | A Table object that is added to the Schema tables. | required | 
Source code in src/cloe_nessy/models/schema.py
              
            
            add_tables(tables)
¶
    Adds tables to the schema.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| tables | list[Table] | A list of Table objects that are added to the Schema tables. | required | 
            get_table_by_name(table_name)
¶
    Return table in schema.
Filters tables in schema for table_name and returns Table object.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table_name | str | Name of table to return from schema. | required | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If table not found in schema metadata. | 
Returns:
| Type | Description | 
|---|---|
| Table | The table. | 
Source code in src/cloe_nessy/models/schema.py
              
            read_instance_from_file(instance_path, fail_on_missing_subfolder=True, table_dir_name='tables', **_)
  
      classmethod
  
¶
    Read a schema from file.
Adds the table objects from a path relative to the schema definition.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| instance_path | str | Path | The path to the Schema definition YAML file. | required | 
| fail_on_missing_subfolder | bool | If False return a tuple with 2 empty lists. Otherwise raise a FileNotFoundError. | True | 
| table_dir_name | str | The name of the directory containing the Table definitions related to this schema. Can be a relative path. | 'tables' | 
Source code in src/cloe_nessy/models/schema.py
              
            Table
¶
    
              Bases: TemplateLoaderMixin, ReadInstancesMixin, LoggerMixin
A Class to represent a Table in Unity Catalog.
Source code in src/cloe_nessy/models/table.py
                | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |  | 
            catalog
  
      property
  
¶
    The name of the Catalog of the Table.
            escaped_identifier
  
      property
  
¶
    The escaped identifier of the Table.
            name
  
      property
  
¶
    The name of the Table.
            schema
  
      property
  
¶
    The name of the Schema of the Table.
            _validate_constraints(raw)
¶
    The constraints are defined with the name as key or as a list and must therefore be transformed.
Source code in src/cloe_nessy/models/table.py
              
            _validate_fk_columns(v, values)
¶
    Foreign keys need to be columns in the table as well.
Source code in src/cloe_nessy/models/table.py
              
            _validate_is_external(table)
¶
    If is_external is set to True, storage_path has to be set.
Source code in src/cloe_nessy/models/table.py
              
            add_column(column)
¶
    Adds a column to the table.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| column | Column | The column to be added. | required | 
            get_column_by_name(column_name)
¶
    Get a column by name.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| column_name | str | The name of the column to get. | required | 
Returns:
| Type | Description | 
|---|---|
| Column | None | The column if found, else None. | 
Source code in src/cloe_nessy/models/table.py
              
            get_create_statement(replace=True)
¶
    Get the create statement for the Table.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| replace | bool | Whether to use the REPLACE statement or not. | True | 
Returns:
| Type | Description | 
|---|---|
| The rendered create statement for the Table. | 
Raises:
| Type | Description | 
|---|---|
| TemplateNotFound | If the template file is not found. | 
Source code in src/cloe_nessy/models/table.py
              
            model_post_init(__context)
¶
    Post init method for the Table model.
Source code in src/cloe_nessy/models/table.py
              
            read_instance_from_file(instance_path, catalog_name=None, schema_name=None, schema_storage_path=None, **_)
  
      classmethod
  
¶
    Read a table instance from file.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| instance_path | str | Path | The path to the Schema definition YAML file. | required | 
| catalog_name | str | None | The name of the Catalog of the Table. | None | 
| schema_name | str | None | The name of the Schema of the Table. | None | 
| schema_storage_path | str | Path | None | The storage path location of the Schema of the Table. | None | 
Returns:
| Type | Description | 
|---|---|
| Self | None | 
 | 
| list[ValidationErrorType] | 
 | 
Raises:
| Type | Description | 
|---|---|
| FileNotFoundError | If the specified directory does not exist or is not a directory and fail_on_missing_subfolder is True. | 
| ValueError | If catalog_name or schema_name are not provided. | 
Source code in src/cloe_nessy/models/table.py
              
            read_instances_from_directory(instance_path, fail_on_missing_subfolder=True, catalog_name=None, schema_name=None, schema_storage_path=None, **_)
  
      classmethod
  
¶
    Reads instances from a directory containing YAML files.
This method scans a specified directory for YAML files (.yaml or .yml), attempts to read and parse each file as an instance of the class, and collects any errors encountered during the process. If the directory does not exist or is not a directory, it either raises a FileNotFoundError (if fail_on_missing_subfolder is True) or returns empty lists.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| instance_path | str | Path | The path to the directory containing instance files. | required | 
| catalog_name | str | None | Name of the catalog to which these instances belong. | None | 
| schema_name | str | None | Name of the schema used for validating the instances. | None | 
| fail_on_missing_subfolder | bool | Determines behavior when the specified directory does not exist or is not a directory. Defaults to True, which will raise a FileNotFoundError. | True | 
| schema_storage_path | str | Path | None | Path to the storage location of the schema these tables instances belong to. | None | 
Returns:
| Type | Description | 
|---|---|
| list[Self] | 
 | 
| list[ValidationErrorType] | 
 | 
Raises:
| Type | Description | 
|---|---|
| FileNotFoundError | If the specified directory does not exist or is not a directory and fail_on_missing_subfolder is True. | 
| ValueError | If catalog_name or schema_name are not provided. | 
Source code in src/cloe_nessy/models/table.py
              
            remove_column(column)
¶
    Remove a column from the Table.
Args. column: The column to be removed.
Source code in src/cloe_nessy/models/table.py
              
            Volume
¶
    
              Bases: TemplateLoaderMixin, LoggerMixin, BaseModel
Volume class for managing volumes.
Source code in src/cloe_nessy/models/volume.py
                
            catalog
  
      property
  
¶
    Return the catalog name.
            escaped_identifier
  
      property
  
¶
    Return the escaped identifier.
            name
  
      property
  
¶
    Return the table name.
            schema_name
  
      property
  
¶
    Return the schema name.
            storage_identifier
  
      property
  
¶
    Return the storage identifier.
            check_identifier(value)
¶
    Check the identifier.
            get_create_statement(if_not_exists=True)
¶
    Get the create statement for the Volume.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| if_not_exists | bool | Whether to include the IF NOT EXISTS clause in the create statement | True | 
Returns:
| Type | Description | 
|---|---|
| The rendered create statement as a string. | 
Source code in src/cloe_nessy/models/volume.py
              
            model_post_init(__context)
¶
    Post init method for the Table model.