table_manager
            TableManager
¶
    
              Bases: LoggerMixin
TableManager class for managing tables.
Source code in src/cloe_nessy/object_manager/table_manager.py
                | 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 |  | 
            _delete_physical_data(table=None, location=None)
¶
    Removes the physical data on the ADLS for the location of this table.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | The Table object representing the Delta table to be deleted. | None | 
| location | str | None | The location of the Delta table to be deleted. | None | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor location is provided, or if both are provided. | 
| ValueError | If the table storage path is not provided by the table object. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            create_table(table, ignore_if_exists=False, replace=False)
¶
    Creates a Table in the catalog.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | A Table object representing the Delta table. | required | 
| ignore_if_exists | bool | If set to True, the function will return early without doing anything if the table already exists. | False | 
| replace | bool | If set to True, the function will replace the table if it already exists. | False | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            drop_table(table=None, storage_location=None, table_identifier=None, delete_physical_data=False)
¶
    Deletes a Table. For security reasons you are forced to pass the table_name.
If delete_physical_data is True the actual physical data on the ADLS will be deleted. Use with caution!
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | The Table object representing the Delta table. | None | 
| storage_location | str | None | The location of the Delta table on the ADLS. | None | 
| table_identifier | str | None | The table identifier in the catalog. Must be in the format 'catalog.schema.table'. | None | 
| delete_physical_data | bool | If set to True, deletes not only the metadata within the Catalog but also the physical data. | False | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor table_identifier is provided, or if both are provided. | 
| ValueError | If the table storage path is not provided by the table object. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            drop_table_from_catalog(table_identifier=None, table=None)
¶
    Removes a table from the catalog. Physical data is retained.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table_identifier | str | None | The table identifier in the catalog. Must be in the format 'catalog.schema.table'. | None | 
| table | Table | None | The Table object representing the Delta table. | None | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor table_identifier is provided, or if both are provided. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            get_delta_table(table=None, location=None, spark=None)
¶
    Get the DeltaTable object from the Table objects location or a location string.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | A Table object representing the Delta table. | None | 
| location | str | None | A string representing the table location. | None | 
| spark | An optional Spark session. If not provided, the current Spark session will be used. | None | 
Returns:
| Type | Description | 
|---|---|
| DeltaTable | The DeltaTable object corresponding to the given Table object or location string. | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor location is provided, or if both are provided. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            refresh_table(table=None, table_identifier=None)
¶
    Refreshes the metadata of a Delta table.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | A Table object representing the Delta table. | None | 
| table_identifier | str | None | The identifier of the Delta table in the format 'catalog.schema.table'. | None | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor table_identifier is provided, or if both are provided. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            table_exists(table=None, table_identifier=None)
¶
    Checks if a table exists in the catalog.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | A Table object representing the Delta table. | None | 
| table_identifier | str | None | A string representing the table identifier in the format 'catalog.schema.table'. | None | 
Returns:
| Type | Description | 
|---|---|
| bool | True if the table exists, else False. | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor table_identifier is provided, or if both are provided. | 
| ValueError | If the table_identifier is not in the format 'catalog.schema.table'. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            truncate_table(table=None, table_identifier=None)
¶
    Truncates a table.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| table | Table | None | A Table object representing the Delta table. | None | 
| table_identifier | str | None | The identifier of the Delta table in the format 'catalog.schema.table'. | None | 
Raises:
| Type | Description | 
|---|---|
| ValueError | If neither table nor table_identifier is provided, or if both are provided. | 
Source code in src/cloe_nessy/object_manager/table_manager.py
              
            TableManagerLogs
  
      dataclass
  
¶
    Dataclass defining the table manager logs table.
Source code in src/cloe_nessy/object_manager/table_manager.py
                
            table_log_decorator(operation)
¶
    Creates a decorator that logs the start, failure (if any), and completion of a table operation.
The created decorator wraps a function that performs an operation on a table. The decorator logs the start of the operation, calls the original function, logs if there was an exception, and logs the completion of the operation. Functions that are wrapped must support the self._table_logger attribute.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| operation | str | The name of the operation to be logged. This will be included in the log messages. | required | 
Returns:
| Name | Type | Description | 
|---|---|---|
| inner_decorator | A decorator that can be used to wrap a function that performs an operation on a table. |