Skip to content

Commit

Permalink
Fix rebase problems
Browse files Browse the repository at this point in the history
  • Loading branch information
ccharlesgb committed Jun 27, 2024
1 parent 03347aa commit 3ac7af3
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dbt_dry_run/literals.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_sql_literal_from_table(table: Table) -> str:
return select_literal


def convert_trees_to_sql(trees: List[sqlglot.Expression]) -> str:
def convert_ast_to_sql(trees: List[sqlglot.Expression]) -> str:
return ";\n".join(tree.sql(sqlglot.dialects.BigQuery) for tree in trees)


Expand Down Expand Up @@ -124,7 +124,7 @@ def transformer(exp: sqlglot.Expression) -> sqlglot.Expression:
transformed_trees = [
parsed.transform(transformer) for parsed in parsed_statements if parsed
]
return convert_trees_to_sql(transformed_trees)
return convert_ast_to_sql(transformed_trees)


def insert_dependant_sql_literals(node: Node, results: Results) -> str:
Expand Down
2 changes: 1 addition & 1 deletion dbt_dry_run/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def with_linting_errors(self, linting_errors: List[LintingError]) -> "DryRunResu

@classmethod
def successful(cls, node: Node, table: Table) -> "DryRunResult":
return cls(node=node, table=table, status=DryRunStatus.SUCCESS, exception=None)
return cls(node=node, table=table, status=DryRunStatus.SUCCESS, exception=None, total_bytes_processed=0)


class Results:
Expand Down
6 changes: 3 additions & 3 deletions dbt_dry_run/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sqlglot
from pydantic import BaseModel, Field

from dbt_dry_run.literals import convert_trees_to_sql
from dbt_dry_run.literals import convert_ast_to_sql
from dbt_dry_run.models import BigQueryFieldMode, BigQueryFieldType, Table, TableField
from dbt_dry_run.models.manifest import Node, NodeConfig, NodeDependsOn, NodeMeta
from dbt_dry_run.results import DryRunResult, DryRunStatus
Expand Down Expand Up @@ -85,11 +85,11 @@ def assert_ast_equivalent(expected: str, actual: str) -> None:
expected_ast = [
t for t in sqlglot.parse(expected, dialect=sqlglot.dialects.BigQuery) if t
]
expected_statement = convert_trees_to_sql(expected_ast)
expected_statement = convert_ast_to_sql(expected_ast)
actual_ast = [
t for t in sqlglot.parse(actual, dialect=sqlglot.dialects.BigQuery) if t
]
actual_statement = convert_trees_to_sql(actual_ast)
actual_statement = convert_ast_to_sql(actual_ast)
assert (
actual_statement == expected_statement
), f"AST Not Equivalent:\nExpected:{expected}\nActual:{actual}"
45 changes: 37 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tenacity = "^8.2"
networkx = ">=2.3,<4.0"
pyyaml = "~6"
typer = "~0"
sqlglot = "^24.1.2"

[tool.poetry.dev-dependencies]
black = "^22"
Expand Down

0 comments on commit 3ac7af3

Please sign in to comment.