dialects/presto.py

sqlglot · sqlglot/dialects/presto.py · python · MIT
database

Implements the Presto SQL dialect to enable parsing, transpilation, and generation of Presto-compliant SQL queries.

# Source: https://github.com/tobymao/sqlglot | License: MIT | Copyright 2026 Toby Mao
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations

import typing as t

from sqlglot import tokens
from sqlglot.dialects.dialect import (
    Dialect,
    NormalizationStrategy,
)
from sqlglot.dialects.mysql import MySQL
from sqlglot.generators.presto import PrestoGenerator
from sqlglot.parsers.presto import PrestoParser
from sqlglot.tokens import TokenType
from sqlglot.typing.presto import EXPRESSION_METADATA


class Presto(Dialect):
    INDEX_OFFSET = 1
    NULL_ORDERING = "nulls_are_last"
    TIME_FORMAT = MySQL.TIME_FORMAT
    STRICT_STRING_CONCAT = True
    TYPED_DIVISION = True
    TABLESAMPLE_SIZE_IS_PERCENT = True
    LOG_BASE_FIRST: bool | None = No

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key