duckdb-kql 0.0.1.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- duckdb_kql-0.0.1.dev1/.gitignore +226 -0
- duckdb_kql-0.0.1.dev1/CODE_OF_CONDUCT.md +71 -0
- duckdb_kql-0.0.1.dev1/CONTRIBUTING.md +195 -0
- duckdb_kql-0.0.1.dev1/LICENSE +21 -0
- duckdb_kql-0.0.1.dev1/PKG-INFO +286 -0
- duckdb_kql-0.0.1.dev1/README.md +208 -0
- duckdb_kql-0.0.1.dev1/SECURITY.md +82 -0
- duckdb_kql-0.0.1.dev1/THIRD-PARTY-NOTICES.md +42 -0
- duckdb_kql-0.0.1.dev1/docs/TRANSLATION.md +411 -0
- duckdb_kql-0.0.1.dev1/docs/ai-cost-strategy.md +191 -0
- duckdb_kql-0.0.1.dev1/docs/api.md +322 -0
- duckdb_kql-0.0.1.dev1/docs/azure-monitor-profile.md +115 -0
- duckdb_kql-0.0.1.dev1/docs/cli.md +185 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/README.md +128 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/kusto-client-compat.md +89 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/public-api-and-typing.md +98 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/review-2026-08-04.md +164 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/security-and-injection.md +105 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/testing-oracle-and-fixtures.md +110 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/tooling-packaging-ci-docs.md +110 -0
- duckdb_kql-0.0.1.dev1/docs/code-review/translation-correctness.md +120 -0
- duckdb_kql-0.0.1.dev1/docs/frequency-scan-results.md +154 -0
- duckdb_kql-0.0.1.dev1/docs/getting-started.md +245 -0
- duckdb_kql-0.0.1.dev1/docs/implementation-options.md +293 -0
- duckdb_kql-0.0.1.dev1/docs/implementation-plan.md +361 -0
- duckdb_kql-0.0.1.dev1/docs/kql-on-duckdb-landscape.md +272 -0
- duckdb_kql-0.0.1.dev1/docs/kql-support.md +410 -0
- duckdb_kql-0.0.1.dev1/docs/kusto-client.md +244 -0
- duckdb_kql-0.0.1.dev1/docs/lessons-from-bun-rewrite.md +224 -0
- duckdb_kql-0.0.1.dev1/docs/licensing.md +157 -0
- duckdb_kql-0.0.1.dev1/docs/m0-grammar-spike.md +136 -0
- duckdb_kql-0.0.1.dev1/docs/oracle-harness.md +159 -0
- duckdb_kql-0.0.1.dev1/docs/test-plan.md +663 -0
- duckdb_kql-0.0.1.dev1/grammar/Kql.g4 +1556 -0
- duckdb_kql-0.0.1.dev1/grammar/KqlTokens.g4 +485 -0
- duckdb_kql-0.0.1.dev1/grammar/UPSTREAM.md +77 -0
- duckdb_kql-0.0.1.dev1/pyproject.toml +194 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/__init__.py +205 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/__main__.py +11 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/Kql.interp +949 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/Kql.tokens +620 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlLexer.interp +984 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlLexer.py +1993 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlLexer.tokens +620 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlListener.py +2748 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlParser.py +26549 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/KqlVisitor.py +1533 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_antlr/__init__.py +0 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/_version.py +24 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/cli.py +335 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/comparison.py +775 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/engine.py +177 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/errors.py +81 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/fixtures.py +310 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/ir.py +373 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/__init__.py +77 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/_models.py +481 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/client.py +588 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/client_request_properties.py +239 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/exceptions.py +96 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/helpers.py +150 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/kusto/response.py +67 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/lower.py +1178 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/oracle.py +197 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/params.py +360 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/parser.py +112 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/py.typed +0 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/schema.py +138 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/translate/__init__.py +1352 -0
- duckdb_kql-0.0.1.dev1/src/duckdb_kql/translate/functions.py +549 -0
- duckdb_kql-0.0.1.dev1/tests/conftest.py +35 -0
- duckdb_kql-0.0.1.dev1/tests/profiles/azure-monitor.json +515 -0
- duckdb_kql-0.0.1.dev1/tests/test_behavior.py +207 -0
- duckdb_kql-0.0.1.dev1/tests/test_cli.py +316 -0
- duckdb_kql-0.0.1.dev1/tests/test_column_order_and_null_sort.py +131 -0
- duckdb_kql-0.0.1.dev1/tests/test_comparison.py +214 -0
- duckdb_kql-0.0.1.dev1/tests/test_corpus.py +218 -0
- duckdb_kql-0.0.1.dev1/tests/test_datetime_traps.py +102 -0
- duckdb_kql-0.0.1.dev1/tests/test_docs.py +228 -0
- duckdb_kql-0.0.1.dev1/tests/test_dynamic.py +209 -0
- duckdb_kql-0.0.1.dev1/tests/test_fixtures.py +146 -0
- duckdb_kql-0.0.1.dev1/tests/test_join.py +150 -0
- duckdb_kql-0.0.1.dev1/tests/test_kusto_client.py +645 -0
- duckdb_kql-0.0.1.dev1/tests/test_let.py +115 -0
- duckdb_kql-0.0.1.dev1/tests/test_null_semantics.py +177 -0
- duckdb_kql-0.0.1.dev1/tests/test_parse.py +129 -0
- duckdb_kql-0.0.1.dev1/tests/test_profile_azure_monitor.py +132 -0
- duckdb_kql-0.0.1.dev1/tests/test_query_parameters.py +311 -0
- duckdb_kql-0.0.1.dev1/tests/test_range_in_render.py +137 -0
- duckdb_kql-0.0.1.dev1/tests/test_summarize.py +178 -0
- duckdb_kql-0.0.1.dev1/tests/test_support_matrix.py +114 -0
- duckdb_kql-0.0.1.dev1/tests/test_typing.py +321 -0
- duckdb_kql-0.0.1.dev1/tests/test_workflows.py +180 -0
- duckdb_kql-0.0.1.dev1/tools/check_profile.py +123 -0
- duckdb_kql-0.0.1.dev1/tools/frequency_scan.py +266 -0
- duckdb_kql-0.0.1.dev1/tools/gen_support_matrix.py +667 -0
- duckdb_kql-0.0.1.dev1/tools/harvest_docs.py +215 -0
- duckdb_kql-0.0.1.dev1/tools/make_fixtures.py +100 -0
- duckdb_kql-0.0.1.dev1/tools/regen_expectations.py +247 -0
- duckdb_kql-0.0.1.dev1/tools/regen_parser.sh +28 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Generated at build time by hatch-vcs from the git tag. Never commit it —
|
|
10
|
+
# a stale copy would silently win over the real version.
|
|
11
|
+
src/duckdb_kql/_version.py
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py.cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
# Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# UV
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# uv.lock
|
|
106
|
+
|
|
107
|
+
# poetry
|
|
108
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
109
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
110
|
+
# commonly ignored for libraries.
|
|
111
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
112
|
+
# poetry.lock
|
|
113
|
+
# poetry.toml
|
|
114
|
+
|
|
115
|
+
# pdm
|
|
116
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
117
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
118
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
119
|
+
# pdm.lock
|
|
120
|
+
# pdm.toml
|
|
121
|
+
.pdm-python
|
|
122
|
+
.pdm-build/
|
|
123
|
+
|
|
124
|
+
# pixi
|
|
125
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
126
|
+
# pixi.lock
|
|
127
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
128
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
129
|
+
.pixi
|
|
130
|
+
|
|
131
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
132
|
+
__pypackages__/
|
|
133
|
+
|
|
134
|
+
# Celery stuff
|
|
135
|
+
celerybeat-schedule
|
|
136
|
+
celerybeat.pid
|
|
137
|
+
|
|
138
|
+
# Redis
|
|
139
|
+
*.rdb
|
|
140
|
+
*.aof
|
|
141
|
+
*.pid
|
|
142
|
+
|
|
143
|
+
# RabbitMQ
|
|
144
|
+
mnesia/
|
|
145
|
+
rabbitmq/
|
|
146
|
+
rabbitmq-data/
|
|
147
|
+
|
|
148
|
+
# ActiveMQ
|
|
149
|
+
activemq-data/
|
|
150
|
+
|
|
151
|
+
# SageMath parsed files
|
|
152
|
+
*.sage.py
|
|
153
|
+
|
|
154
|
+
# Environments
|
|
155
|
+
.env
|
|
156
|
+
.envrc
|
|
157
|
+
.venv
|
|
158
|
+
env/
|
|
159
|
+
venv/
|
|
160
|
+
ENV/
|
|
161
|
+
env.bak/
|
|
162
|
+
venv.bak/
|
|
163
|
+
|
|
164
|
+
# Spyder project settings
|
|
165
|
+
.spyderproject
|
|
166
|
+
.spyproject
|
|
167
|
+
|
|
168
|
+
# Rope project settings
|
|
169
|
+
.ropeproject
|
|
170
|
+
|
|
171
|
+
# mkdocs documentation
|
|
172
|
+
/site
|
|
173
|
+
|
|
174
|
+
# mypy
|
|
175
|
+
.mypy_cache/
|
|
176
|
+
.dmypy.json
|
|
177
|
+
dmypy.json
|
|
178
|
+
|
|
179
|
+
# Pyre type checker
|
|
180
|
+
.pyre/
|
|
181
|
+
|
|
182
|
+
# pytype static type analyzer
|
|
183
|
+
.pytype/
|
|
184
|
+
|
|
185
|
+
# Cython debug symbols
|
|
186
|
+
cython_debug/
|
|
187
|
+
|
|
188
|
+
# PyCharm
|
|
189
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
190
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
191
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
192
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
193
|
+
# .idea/
|
|
194
|
+
|
|
195
|
+
# Abstra
|
|
196
|
+
# Abstra is an AI-powered process automation framework.
|
|
197
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
198
|
+
# Learn more at https://abstra.io/docs
|
|
199
|
+
.abstra/
|
|
200
|
+
|
|
201
|
+
# Visual Studio Code
|
|
202
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
203
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
204
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
205
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
206
|
+
# .vscode/
|
|
207
|
+
# Temporary file for partial code execution
|
|
208
|
+
tempCodeRunnerFile.py
|
|
209
|
+
|
|
210
|
+
# Ruff stuff:
|
|
211
|
+
.ruff_cache/
|
|
212
|
+
|
|
213
|
+
# PyPI configuration file
|
|
214
|
+
.pypirc
|
|
215
|
+
|
|
216
|
+
# Marimo
|
|
217
|
+
marimo/_static/
|
|
218
|
+
marimo/_lsp/
|
|
219
|
+
__marimo__/
|
|
220
|
+
|
|
221
|
+
# Streamlit
|
|
222
|
+
.streamlit/secrets.toml
|
|
223
|
+
|
|
224
|
+
# duckdb-kql
|
|
225
|
+
.antlr/
|
|
226
|
+
tests/cases/**/unparsed.json
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Code of conduct
|
|
2
|
+
|
|
3
|
+
## Our pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment:
|
|
18
|
+
|
|
19
|
+
- Demonstrating empathy and kindness toward other people
|
|
20
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
21
|
+
- Giving and gracefully accepting constructive feedback
|
|
22
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
|
23
|
+
and learning from the experience
|
|
24
|
+
- Focusing on what is best not just for us as individuals, but for the overall
|
|
25
|
+
community
|
|
26
|
+
|
|
27
|
+
Examples of unacceptable behavior:
|
|
28
|
+
|
|
29
|
+
- The use of sexualized language or imagery, and sexual attention or advances of
|
|
30
|
+
any kind
|
|
31
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
32
|
+
- Public or private harassment
|
|
33
|
+
- Publishing others' private information, such as a physical or email address,
|
|
34
|
+
without their explicit permission
|
|
35
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
|
36
|
+
professional setting
|
|
37
|
+
|
|
38
|
+
## Enforcement responsibilities
|
|
39
|
+
|
|
40
|
+
Project maintainers are responsible for clarifying and enforcing our standards
|
|
41
|
+
of acceptable behavior and will take appropriate and fair corrective action in
|
|
42
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
43
|
+
or harmful.
|
|
44
|
+
|
|
45
|
+
Maintainers have the right and responsibility to remove, edit, or reject
|
|
46
|
+
comments, commits, code, issues, and other contributions that are not aligned to
|
|
47
|
+
this Code of Conduct, and will communicate reasons for moderation decisions when
|
|
48
|
+
appropriate.
|
|
49
|
+
|
|
50
|
+
## Scope
|
|
51
|
+
|
|
52
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
53
|
+
an individual is officially representing the community in public spaces.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported to the maintainers through
|
|
59
|
+
[GitHub's private reporting](https://github.com/mmaitre314/duckdb-kql/security/advisories/new)
|
|
60
|
+
or by opening an issue if the matter is not sensitive. All complaints will be
|
|
61
|
+
reviewed and investigated promptly and fairly.
|
|
62
|
+
|
|
63
|
+
Maintainers are obligated to respect the privacy and security of the reporter of
|
|
64
|
+
any incident.
|
|
65
|
+
|
|
66
|
+
## Attribution
|
|
67
|
+
|
|
68
|
+
This Code of Conduct is adapted from the
|
|
69
|
+
[Contributor Covenant](https://www.contributor-covenant.org), version 2.1,
|
|
70
|
+
available at
|
|
71
|
+
https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for looking. This project has one unusual rule, and most of what follows
|
|
4
|
+
is a consequence of it.
|
|
5
|
+
|
|
6
|
+
> **A wrong answer is worse than no answer.** KQL and SQL look alike in places
|
|
7
|
+
> where they behave differently, so a mapping that is *nearly* right runs
|
|
8
|
+
> cleanly and returns numbers nobody questions. Every mapping here is verified
|
|
9
|
+
> against the real KQL engine, and anything that cannot be verified raises
|
|
10
|
+
> instead.
|
|
11
|
+
|
|
12
|
+
## Getting set up
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/mmaitre314/duckdb-kql
|
|
16
|
+
cd duckdb-kql
|
|
17
|
+
pip install -e ".[dev]"
|
|
18
|
+
pytest
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
A dev container is included (`.devcontainer/`) if you would rather not install
|
|
22
|
+
Docker, DuckDB and the emulator yourself.
|
|
23
|
+
|
|
24
|
+
Before opening a pull request:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ruff check src tools tests
|
|
28
|
+
mypy
|
|
29
|
+
pytest
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
All three run in CI on every pull request.
|
|
33
|
+
|
|
34
|
+
## Adding a mapping
|
|
35
|
+
|
|
36
|
+
Most contributions are one KQL function or operator. The shape is the same each
|
|
37
|
+
time:
|
|
38
|
+
|
|
39
|
+
1. **Find the ground truth.** Run the construct on the Kusto Emulator and record
|
|
40
|
+
what it actually returns — including the edge cases (null input, empty
|
|
41
|
+
string, out-of-range index, negative number). `docs/oracle-harness.md`
|
|
42
|
+
explains how to run it. Do not infer behaviour from Microsoft's docs; several
|
|
43
|
+
of the divergences already recorded here contradict them.
|
|
44
|
+
2. **Add a registry row.** Mappings are data, not code:
|
|
45
|
+
`src/duckdb_kql/translate/functions.py` holds one row per construct, citing
|
|
46
|
+
the `R`-rules it must honour. If your mapping needs a shape a `{0}`-style
|
|
47
|
+
template cannot express, add a special form in `translate/__init__.py` and
|
|
48
|
+
say why in a comment.
|
|
49
|
+
3. **Write the trap test.** Not "it returns something" — the specific case where
|
|
50
|
+
the obvious mapping would be wrong. If you cannot think of one, look harder:
|
|
51
|
+
`docs/TRANSLATION.md` §4 lists twelve places the two languages diverge.
|
|
52
|
+
4. **Regenerate the support matrix.**
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
python tools/gen_support_matrix.py
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`docs/kql-support.md` is generated and CI fails if it is stale. Fill in the
|
|
59
|
+
`Limitations and gotchas` cell with what you learned in step 1 — that column
|
|
60
|
+
is the point of the document.
|
|
61
|
+
5. **Update the baselines** if coverage moved:
|
|
62
|
+
`tests/test_behavior.py::BASELINE_PASSING` and
|
|
63
|
+
`tests/test_profile_azure_monitor.py::BASELINE_SUPPORTED` may only go up.
|
|
64
|
+
|
|
65
|
+
## When *not* to add a mapping
|
|
66
|
+
|
|
67
|
+
Refusing is a valid, and sometimes the correct, outcome. Add the construct to
|
|
68
|
+
the refusal list in `tools/gen_support_matrix.py` with a reason if:
|
|
69
|
+
|
|
70
|
+
- the nearest DuckDB function is a *different* function that returns
|
|
71
|
+
plausible-looking output (`hash_xxhash64` → DuckDB's `hash`);
|
|
72
|
+
- the precision or algorithm cannot be matched (`datetime_part('nanosecond')`,
|
|
73
|
+
the `hll` and `tdigest` sketch formats);
|
|
74
|
+
- it would require network or code execution (`geo_location`, the plugins).
|
|
75
|
+
|
|
76
|
+
A refusal with a reason is a contribution. A mapping that is 95% right is a bug
|
|
77
|
+
report waiting to be filed against someone else's report.
|
|
78
|
+
|
|
79
|
+
## Things CI will check that are easy to miss
|
|
80
|
+
|
|
81
|
+
| Check | Why |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `docs/kql-support.md` regenerates identically | The support table must not be able to say something the code does not do. |
|
|
84
|
+
| The documented request-option table matches `OPTION_SUPPORT` | Same reason, for the Kusto client. |
|
|
85
|
+
| Layer 0 installs and works with `duckdb` absent | The layering claim is only true if it is tested. |
|
|
86
|
+
| The CLI does not import `duckdb` | Build-time translation is meant to run in a minimal CI image. |
|
|
87
|
+
| Links in the docs resolve | Including the absolute ones the README uses for PyPI. |
|
|
88
|
+
| A consumer's type checker sees real types | The package ships `py.typed`, so `Any` in a public signature is a promise broken silently. `tests/test_typing.py` checks from the outside; `mypy` alone cannot. |
|
|
89
|
+
| The committed parser matches `grammar/Kql.g4` | The generated parser is committed so installs need no Java. |
|
|
90
|
+
|
|
91
|
+
## The emulator
|
|
92
|
+
|
|
93
|
+
The acceptance suite compares against the Kusto Emulator, which runs in Docker.
|
|
94
|
+
It is a **development and CI tool only**: never a runtime dependency, never
|
|
95
|
+
redistributed, never exposed as a service. Per its licence, do not publish
|
|
96
|
+
timing or performance numbers measured against it. See `docs/licensing.md` §5.
|
|
97
|
+
|
|
98
|
+
Contributions that only touch translation logic do not need it — the frozen
|
|
99
|
+
corpus in `tests/cases/` carries the expectations it produced. You need the
|
|
100
|
+
emulator when you are adding a mapping and have to *establish* an expectation.
|
|
101
|
+
|
|
102
|
+
## Reviewing a change
|
|
103
|
+
|
|
104
|
+
Reviews here are checklist-led and organized by area, because the dangerous
|
|
105
|
+
change in this project is the one that runs cleanly and returns a *plausible
|
|
106
|
+
wrong answer*. [`docs/code-review/`](docs/code-review/README.md) is the
|
|
107
|
+
framework: a charter (severity scale, reporting format, and the small-diff /
|
|
108
|
+
checklist discipline the literature backs) plus one checklist per area of the
|
|
109
|
+
codebase — translation correctness, public API & typing, security & injection,
|
|
110
|
+
the Kusto client, testing & the oracle, and tooling/packaging/CI/docs. Reviewing
|
|
111
|
+
a change means picking the area(s) it touches and working its list; the
|
|
112
|
+
[`adversarial-reviewer`](.claude/agents/adversarial-reviewer.md) agent automates
|
|
113
|
+
the translation-correctness pass over a mapping diff.
|
|
114
|
+
|
|
115
|
+
## Style
|
|
116
|
+
|
|
117
|
+
Match the surrounding code. Two habits worth copying:
|
|
118
|
+
|
|
119
|
+
- **Comments explain the trap, not the mechanism.** `# KQL weeks start Sunday;
|
|
120
|
+
date_trunc('week') starts Monday` is worth writing. `# truncate the date` is
|
|
121
|
+
not.
|
|
122
|
+
- **Tests are named after what would break.** `test_payload_never_reaches_the_sql_text`
|
|
123
|
+
says what is being protected; `test_parameters` does not.
|
|
124
|
+
- **`Any` is declared, not defaulted.** The package is fully typed and ships
|
|
125
|
+
`py.typed`. Where a value genuinely has no type — an ANTLR tree node, a
|
|
126
|
+
`dynamic` document — say `Any` and say why in a comment. An unannotated
|
|
127
|
+
function silently becomes `Any` for every caller, which is the same failure
|
|
128
|
+
mode as a wrong answer: it looks fine.
|
|
129
|
+
|
|
130
|
+
## Reporting a wrong answer
|
|
131
|
+
|
|
132
|
+
The most valuable bug report for this project is a query that runs and returns
|
|
133
|
+
something different from Kusto. Please include the KQL, the result you got, the
|
|
134
|
+
result Kusto gave, and — if you have it — the output of:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
duckdb_kql.to_sql(your_query)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Security issues go through [SECURITY.md](SECURITY.md) instead, not the public
|
|
141
|
+
tracker.
|
|
142
|
+
|
|
143
|
+
## Releasing (maintainers)
|
|
144
|
+
|
|
145
|
+
**The git tag is the version.** There is no file to bump: `hatch-vcs` reads the
|
|
146
|
+
tag at build time and writes it into the distribution, so the tag and the package
|
|
147
|
+
cannot disagree.
|
|
148
|
+
|
|
149
|
+
Publishing is automated but deliberately not automatic — only a **published
|
|
150
|
+
GitHub Release** uploads to PyPI. A tag on its own builds and checks; it does
|
|
151
|
+
not publish, so a bad tag costs nothing.
|
|
152
|
+
|
|
153
|
+
The whole procedure:
|
|
154
|
+
|
|
155
|
+
1. Go to **Releases → Draft a new release**, create the tag `vX.Y.Z` on `main`,
|
|
156
|
+
click **Generate release notes**, and publish.
|
|
157
|
+
|
|
158
|
+
That is it. The release workflow builds the sdist and wheel, verifies the built
|
|
159
|
+
version equals the tag, smoke-tests the wheel in a clean environment, uploads to
|
|
160
|
+
PyPI via [Trusted Publishing][oidc], and attaches the artifacts to the release.
|
|
161
|
+
|
|
162
|
+
Two things worth doing around it:
|
|
163
|
+
|
|
164
|
+
- **Rehearse with a manual run** for a first release, or after any packaging
|
|
165
|
+
change: *Actions → Release → Run workflow*. That does everything except
|
|
166
|
+
publish — build, metadata check, and the clean-environment smoke test of the
|
|
167
|
+
wheel — so a packaging break surfaces without spending a version number. The
|
|
168
|
+
same build also runs on every push and pull request.
|
|
169
|
+
|
|
170
|
+
- **Edit the generated notes** before publishing. There is no `CHANGELOG.md`;
|
|
171
|
+
the release notes and the git history are the record. *Generate release notes*
|
|
172
|
+
gives you the list of commits, which is a fine skeleton and a poor explanation
|
|
173
|
+
— so lead with a short paragraph on what changed for the people using the
|
|
174
|
+
package, especially anything that returns a different answer than it did
|
|
175
|
+
before. This is the reason commit messages here are written to be read.
|
|
176
|
+
|
|
177
|
+
**Before the very first release**, two one-time setup steps that only an owner
|
|
178
|
+
can do:
|
|
179
|
+
|
|
180
|
+
1. Register the PyPI publisher (a *pending* publisher, since the project does not
|
|
181
|
+
exist yet) at <https://pypi.org/manage/account/publishing/>: owner
|
|
182
|
+
`mmaitre314`, repository `duckdb-kql`, workflow `release.yml`, environment
|
|
183
|
+
`pypi`.
|
|
184
|
+
2. Create the `pypi` environment under **Settings → Environments**. The name
|
|
185
|
+
must match the publisher registration, because PyPI checks the environment in
|
|
186
|
+
the OIDC claim. Adding yourself as a required reviewer on it makes every
|
|
187
|
+
upload a deliberate two-step action.
|
|
188
|
+
|
|
189
|
+
## Licensing
|
|
190
|
+
|
|
191
|
+
Contributions are accepted under the MIT licence in [LICENSE](LICENSE). If you
|
|
192
|
+
vendor anything third-party, add it to
|
|
193
|
+
[THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md) and check
|
|
194
|
+
[`docs/licensing.md`](docs/licensing.md) for how the existing entries are
|
|
195
|
+
handled.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthieu Maitre
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|