summaryrefslogtreecommitdiffstats
path: root/sqlglot/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/__init__.py')
-rw-r--r--sqlglot/__init__.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/sqlglot/__init__.py b/sqlglot/__init__.py
index f7440e0..8fb623a 100644
--- a/sqlglot/__init__.py
+++ b/sqlglot/__init__.py
@@ -6,6 +6,7 @@
from __future__ import annotations
+import logging
import typing as t
from sqlglot import expressions as exp
@@ -45,12 +46,19 @@ from sqlglot.schema import MappingSchema as MappingSchema, Schema as Schema
from sqlglot.tokens import Tokenizer as Tokenizer, TokenType as TokenType
if t.TYPE_CHECKING:
+ from sqlglot._typing import E
from sqlglot.dialects.dialect import DialectType as DialectType
- T = t.TypeVar("T", bound=Expression)
+logger = logging.getLogger("sqlglot")
-__version__ = "12.2.0"
+try:
+ from sqlglot._version import __version__, __version_tuple__
+except ImportError:
+ logger.error(
+ "Unable to set __version__, run `pip install -e .` or `python setup.py develop` first."
+ )
+
pretty = False
"""Whether to format generated SQL by default."""
@@ -79,9 +87,9 @@ def parse(sql: str, read: DialectType = None, **opts) -> t.List[t.Optional[Expre
def parse_one(
sql: str,
read: None = None,
- into: t.Type[T] = ...,
+ into: t.Type[E] = ...,
**opts,
-) -> T:
+) -> E:
...
@@ -89,9 +97,9 @@ def parse_one(
def parse_one(
sql: str,
read: DialectType,
- into: t.Type[T],
+ into: t.Type[E],
**opts,
-) -> T:
+) -> E:
...