Coverage for src / lexigram / contracts / data / sql / sql_dialect.py: 0%
10 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-15 18:57 +0800
1"""SQL dialect enumeration for Lexigram.
3Defines the supported SQL dialects and their identifier quoting conventions.
4These are pure value types with no database dependencies, suitable for use
5across all packages that need SQL identifier validation.
6"""
8from __future__ import annotations
10from enum import StrEnum
11from typing import Final
14class SQLDialect(StrEnum):
15 """Supported SQL database dialects."""
17 POSTGRESQL = "postgresql"
18 MYSQL = "mysql"
19 SQLITE = "sqlite"
22# Maximum identifier lengths by dialect (from official documentation).
23MAX_IDENTIFIER_LENGTHS: Final[dict[SQLDialect, int]] = {
24 SQLDialect.POSTGRESQL: 63,
25 SQLDialect.MYSQL: 64,
26 SQLDialect.SQLITE: 128,
27}
29# Default max length used when dialect is unknown.
30DEFAULT_MAX_IDENTIFIER_LENGTH: Final[int] = 63
32__all__ = [
33 "DEFAULT_MAX_IDENTIFIER_LENGTH",
34 "MAX_IDENTIFIER_LENGTHS",
35 "SQLDialect",
36]