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

1"""SQL dialect enumeration for Lexigram. 

2 

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""" 

7 

8from __future__ import annotations 

9 

10from enum import StrEnum 

11from typing import Final 

12 

13 

14class SQLDialect(StrEnum): 

15 """Supported SQL database dialects.""" 

16 

17 POSTGRESQL = "postgresql" 

18 MYSQL = "mysql" 

19 SQLITE = "sqlite" 

20 

21 

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} 

28 

29# Default max length used when dialect is unknown. 

30DEFAULT_MAX_IDENTIFIER_LENGTH: Final[int] = 63 

31 

32__all__ = [ 

33 "DEFAULT_MAX_IDENTIFIER_LENGTH", 

34 "MAX_IDENTIFIER_LENGTHS", 

35 "SQLDialect", 

36]