common.normalizers.naming.naming
NamingConvention Objects
class NamingConvention(ABC)
Initializes naming convention to generate identifier with max_length
if specified. Base naming convention
is case sensitive by default
PATH_SEPARATOR
Subsequent nested fields will be separated with the string below, applies both to field and table names
is_case_sensitive
@property
@abstractmethod
def is_case_sensitive() -> bool
Tells if given naming convention is producing case insensitive or case sensitive identifiers.
normalize_identifier
@abstractmethod
def normalize_identifier(identifier: str) -> str
Normalizes and shortens the identifier according to naming convention in this function code
normalize_table_identifier
def normalize_table_identifier(identifier: str) -> str
Normalizes and shortens identifier that will function as a dataset, table or schema name, defaults to normalize_identifier
make_path
def make_path(*identifiers: str) -> str
Builds path out of identifiers. Identifiers are neither normalized nor shortened
break_path
def break_path(path: str) -> Sequence[str]
Breaks path into sequence of identifiers
normalize_path
def normalize_path(path: str) -> str
Breaks path into identifiers, normalizes components, reconstitutes and shortens the path
normalize_tables_path
def normalize_tables_path(path: str) -> str
Breaks path of table identifiers, normalizes components, reconstitutes and shortens the path
shorten_fragments
def shorten_fragments(*normalized_idents: str) -> str
Reconstitutes and shortens the path of normalized identifiers
name
@classmethod
def name(cls) -> str
Naming convention name is the name of the module in which NamingConvention is defined
shorten_identifier
@staticmethod
@lru_cache(maxsize=None)
def shorten_identifier(normalized_ident: str,
identifier: str,
max_length: int,
collision_prob: float = _DEFAULT_COLLISION_PROB) -> str
Shortens the name
to max_length
and adds a tag to it to make it unique. Tag may be placed in the middle or at the end