Skip to main content
Version: 0.5.4

common.normalizers.naming.naming

NamingConvention Objects

class NamingConvention(ABC)

[view_source]

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

[view_source]

Tells if given naming convention is producing case insensitive or case sensitive identifiers.

normalize_identifier

@abstractmethod
def normalize_identifier(identifier: str) -> str

[view_source]

Normalizes and shortens the identifier according to naming convention in this function code

normalize_table_identifier

def normalize_table_identifier(identifier: str) -> str

[view_source]

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

[view_source]

Builds path out of identifiers. Identifiers are neither normalized nor shortened

break_path

def break_path(path: str) -> Sequence[str]

[view_source]

Breaks path into sequence of identifiers

normalize_path

def normalize_path(path: str) -> str

[view_source]

Breaks path into identifiers, normalizes components, reconstitutes and shortens the path

normalize_tables_path

def normalize_tables_path(path: str) -> str

[view_source]

Breaks path of table identifiers, normalizes components, reconstitutes and shortens the path

shorten_fragments

def shorten_fragments(*normalized_idents: str) -> str

[view_source]

Reconstitutes and shortens the path of normalized identifiers

name

@classmethod
def name(cls) -> str

[view_source]

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

[view_source]

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

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.