0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
posthog/hogql_parser/__init__.pyi
Michael Matloka 21c699772c
chore(hogql): Use the C++ parser in 50% of queries (#18298)
* chore(hogql): Use the C++ parser in 50% of queries

* Ensure that C++ parser is used in tests deterministically

* Align table args behavior with Python

* Bump parser version to 1.0.1

* Use new hogql-parser version

* Don't add notices for internal expressions, like in Python

* Bump parser version to 1.0.2

* Use new hogql-parser version

* Update posthog/hogql/parser.py

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-01 11:52:44 +01:00

31 lines
991 B
Python

from posthog.hogql.ast import SelectQuery, SelectUnionQuery
from posthog.hogql.base import AST
def parse_expr(expr: str, /, *, is_internal: bool = False) -> AST:
"""Parse the HogQL expression string into an AST.
If the expr `is_internal`, spans and notices won't be included in the AST.
"""
...
def parse_order_expr(expr: str, /, *, is_internal: bool = False) -> AST:
"""Parse the ORDER BY clause string into an AST.
If the expr `is_internal`, spans and notices won't be included in the AST.
"""
...
def parse_select(expr: str, /, *, is_internal: bool = False) -> SelectQuery | SelectUnionQuery:
"""Parse the HogQL SELECT statement string into an AST.
If the expr `is_internal`, spans and notices won't be included in the AST.
"""
...
def unquote_string(value: str, /) -> str:
"""Unquote the string (an identifier or a string literal).
If the expr is `internal`, spans and notices won't be included in the AST.
"""
...