Coverage for datakiln/metadata/dialect.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-16 23:23 +0000

1""" 

2SQL dialects. 

3""" 

4from sqlglot.dialects.postgres import Postgres 

5from sqlglot.tokens import TokenType 

6 

7 

8class ExtendedPostgres(Postgres): 

9 """PostgreSQL with the syntax that SQLGlot does not read. An aggregate is 

10 created like a function, with options in place of a body.""" 

11 

12 class Tokenizer(Postgres.Tokenizer): 

13 """Tokenizer that reads AGGREGATE as it reads FUNCTION.""" 

14 

15 KEYWORDS = {**Postgres.Tokenizer.KEYWORDS, 

16 "AGGREGATE": TokenType.FUNCTION} 

17 

18 

19# SQLAlchemy dialect names and the same dialects in SQLGlot, by name or class 

20DIALECT_MAP = { 

21 "postgresql": ExtendedPostgres, 

22 "mssql": "tsql" 

23}