Skip to content
Prev Previous commit
Next Next commit
Revert to importing builtins from typing
  • Loading branch information
max-sixty committed Oct 5, 2022
commit ebff2ceb726f1978fed669209b250e68fb3ed13d
7 changes: 4 additions & 3 deletions core/dbt/parser/_dbt_prql.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
import logging
import re
from collections import defaultdict
import typing

if typing.TYPE_CHECKING:
from dbt.parser.language_provider import references_type

try:
import prql_python # type: ignore
Expand Down Expand Up @@ -37,9 +41,6 @@ def to_sql(prql):
word_regex = r"[\w\.\-_]+"
references_regex = rf"\bdbt `?(\w+)\.({word_regex})\.({word_regex})`?"

# dict of ref_type (e.g. source, ref) -> (dict of (package, table) -> literal)
references_type = dict[str, dict[tuple[str, str], str]]


def compile(prql: str, references: references_type):
"""
Expand Down
8 changes: 7 additions & 1 deletion core/dbt/parser/language_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
dbt_prql = None

# dict of ref_type (e.g. source, ref) -> (dict of (package, table) -> literal)
references_type = dict[str, dict[tuple[str, str], str]]
# references_type = dict[str, dict[tuple[str, str], str]]

# I can't get the above to work on CI; I had thought that it was fine with
# from __future__ import annotations, but it seems not. So, we'll just use Dict.
from typing import Dict, Tuple

references_type = Dict[str, Dict[Tuple[str, str], str]]


class LanguageProvider:
Expand Down