Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AttrDict instead of agate #604

Merged
merged 11 commits into from
Jan 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions dbt/adapters/spark/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from dbt.adapters.base import BaseRelation
from dbt.clients.agate_helper import DEFAULT_TYPE_TESTER
from dbt.events import AdapterLogger
from dbt.utils import executor
from dbt.utils import executor, AttrDict

logger = AdapterLogger("Spark")

Expand Down Expand Up @@ -176,9 +176,7 @@ def get_relation(self, database: str, schema: str, identifier: str) -> Optional[

return super().get_relation(database, schema, identifier)

def parse_describe_extended(
self, relation: Relation, raw_rows: List[agate.Row]
) -> List[SparkColumn]:
def parse_describe_extended(self, relation: Relation, raw_rows: AttrDict) -> List[SparkColumn]:
# Convert the Row to a dict
dict_rows = [dict(zip(row._keys, row._values)) for row in raw_rows]
# Find the separator between the rows and the metadata provided
Expand Down Expand Up @@ -218,7 +216,7 @@ def find_table_information_separator(rows: List[dict]) -> int:
def get_columns_in_relation(self, relation: Relation) -> List[SparkColumn]:
columns = []
try:
rows: List[agate.Row] = self.execute_macro(
rows: AttrDict = self.execute_macro(
GET_COLUMNS_IN_RELATION_RAW_MACRO_NAME, kwargs={"relation": relation}
)
columns = self.parse_describe_extended(relation, rows)
Expand Down