Metadata-Version: 2.5
Name: vertica-sqlglot-dialect
Version: 0.2.1
Summary: A coverage-driven Vertica dialect plugin for SQLGlot
Project-URL: Documentation, https://github.com/luisdelatorre012/vertica-sqlglot-dialect#readme
Project-URL: Issues, https://github.com/luisdelatorre012/vertica-sqlglot-dialect/issues
Project-URL: Repository, https://github.com/luisdelatorre012/vertica-sqlglot-dialect
Author: Luis de la Torre
License-Expression: MIT
License-File: LICENSE
Keywords: dialect,opentext,parser,sql,sqlglot,transpiler,vertica
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: sqlglot<30.14.0,>=30.13.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy<2.0,>=1.15; extra == 'dev'
Requires-Dist: pre-commit<4.4,>=4.3; (python_version < '3.10') and extra == 'dev'
Requires-Dist: pre-commit<5,>=4.6.2; (python_version >= '3.10') and extra == 'dev'
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.11; extra == 'dev'
Description-Content-Type: text/markdown

# SQLGlot Vertica dialect

`vertica-sqlglot-dialect` is a separately distributed
[SQLGlot](https://github.com/tobymao/sqlglot) dialect for Vertica / OpenText
Analytics Database SQL.

This repository is a from-scratch successor to the 0.1.x package. Its design is
coverage-driven: every supported Vertica language family is tracked in
[`docs/COVERAGE.md`](docs/COVERAGE.md), and dialect behavior is protected by
round-trip and cross-dialect regression tests.

The AST and compatibility rules are documented in
[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md), with the audited primary
references listed in [`docs/SOURCES.md`](docs/SOURCES.md).
The remaining implementation phases and their release gates are tracked in
[`docs/ROADMAP.md`](docs/ROADMAP.md).

The current development baseline is:

- OpenText Analytics Database / Vertica 26.2 SQL
- SQLGlot 30.13.x
- Python 3.9 through 3.15

Python 3.15 support is tested against the latest available prerelease until
CPython 3.15 reaches general availability.

Milestone 1, the complete analysis parsing surface for SELECT/CTE and
temporary-table workloads, is certified across the supported runtime matrix.

The SQLGlot dependency is intentionally bounded to one minor line because
dialect parser/generator subclass APIs can change between minor releases. The
supported runtime is pure-Python SQLGlot; the optional compiled `sqlglot[c]`
runtime does not currently guarantee custom-dialect subclass compatibility.

## Installation

Install the current release from PyPI:

```console
pip install vertica-sqlglot-dialect
```

Pin the release for a reproducible installation with
`pip install vertica-sqlglot-dialect==0.2.1`.

SQLGlot discovers the dialect through the package entry point:

```python
from sqlglot import parse_one, transpile

tree = parse_one("SELECT TIMESTAMPADD(day, 1, created_at) FROM events", read="vertica")
print(tree.sql(dialect="vertica"))

print(transpile("SELECT NOW()", read="postgres", write="vertica")[0])
```

The class can also be passed directly, which is useful in environments that do
not load Python package entry points:

```python
from sqlglot import parse_one
from sqlglot_vertica import Vertica

tree = parse_one("SELECT 1", read=Vertica)
```

## Development

```console
python -m venv .venv
.venv/Scripts/python -m pip install -e ".[dev]"
.venv/Scripts/python -m pre_commit install --install-hooks
.venv/Scripts/python -m pytest
.venv/Scripts/ruff check .
.venv/Scripts/ruff format --check .
.venv/Scripts/mypy src
.venv/Scripts/python -m pre_commit run --all-files --show-diff-on-failure
```

On POSIX systems, replace `.venv/Scripts` with `.venv/bin`. The installed hooks
run repository hygiene and safety checks, Ruff autofixes and formatting, strict
mypy, and [Conventional Commits](https://www.conventionalcommits.org/) message
validation. Commit without `--no-verify`; if a hook fixes a file, review the
change, restage it, and rerun the checks before retrying the commit.

The full coverage, multi-version, build, and installed-wheel checks are
available through `scripts/release_gate.ps1` and remain required by the agent
release gate and CI. The script reuses ignored download caches while retaining
isolated runtime and clean-wheel environments. Hook revisions are frozen to
immutable commits; maintainers can update them deliberately with
`python -m pre_commit autoupdate --freeze`.

The coverage matrix distinguishes semantic support from lossless command
preservation. “Preserved” means SQLGlot retains a statement as a command but
does not yet expose all of its clauses as traversable AST nodes.

Security-policy DDL includes a typed, non-secret PROFILE lifecycle. CREATE and
ALTER retain ordered password-policy metadata, ALTER also supports reset and
rename actions, and DROP retains ordered targets and dependency cascading.
PROFILE nodes never contain password values; user assignment and catalog
effects remain separate server concerns.

The non-secret USER lifecycle also retains ordered time and capacity policy:
grace, idle-session and query-runtime intervals; database/node connection
limits; memory and temporary-space caps; and ALTER-only hash-algorithm
selection. ALTER additionally models TOTP-secret reset, value-free configuration
clears, and a five-parameter depot-only SET allowlist with finite values.
Credential clauses and unreviewed SET values remain outside the AST and fail
with sanitized errors.

AUTHENTICATION lifecycle is semantic for its non-secret core. ALTER SET admits
only the closed `validate_type` (`IDP`/`JWT`) and `jit_enabled` (`yes`/`no`)
domains; credentials, arbitrary strings, and unknown parameters are rejected
by the sanitizer before they can enter an AST.

Executable `PROFILE statement` is also semantic: the wrapper retains a
traversable SELECT, INSERT, UPDATE, DELETE, COPY, or MERGE child so analysis and
optimizer traversal can inspect the statement that Vertica profiles.

## License

MIT
