Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmeireles committed Jan 7, 2025
1 parent d544450 commit 40d40b2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 11 additions & 6 deletions dbt/adapters/dremio/api/rest/entities/reflection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from enum import Enum


class TransformType(Enum):
YEAR = "YEAR"
MONTH = "MONTH"
Expand All @@ -25,11 +26,11 @@ def from_string(cls, transform_str):

def to_transform(self, raw_str):
if self in (
TransformType.YEAR,
TransformType.MONTH,
TransformType.DAY,
TransformType.HOUR,
TransformType.IDENTITY
TransformType.YEAR,
TransformType.MONTH,
TransformType.DAY,
TransformType.HOUR,
TransformType.IDENTITY
):
return {"type": self.value}

Expand All @@ -49,8 +50,12 @@ def to_transform(self, raw_str):

return {"type": TransformType.IDENTITY.value}


# https://docs.dremio.com/24.3.x/reference/api/reflections/
class ReflectionEntity:
def __init__(self, name, reflection_type, dataset_id, display_fields, dimensions, date_dimensions, measures, computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by, arrow_cache):
def __init__(self, name, reflection_type, dataset_id, display_fields, dimensions, date_dimensions, measures,
computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by,
arrow_cache):
self.__name = name
self.__type = reflection_type
self.__dataset_id = dataset_id
Expand Down
7 changes: 5 additions & 2 deletions dbt/adapters/dremio/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ def create_catalog(self, relation):
self._create_folders(database, schema, rest_client)
return

def create_reflection(self, name: str, reflection_type: str, anchor: DremioRelation, display: List[str], dimensions: List[str],
def create_reflection(self, name: str, reflection_type: str, anchor: DremioRelation, display: List[str],
dimensions: List[str],
date_dimensions: List[str], measures: List[str],
computations: List[str], partition_by: List[str], partition_transform: List[str],
partition_method: str, distribute_by: List[str], localsort_by: List[str],
Expand All @@ -255,7 +256,9 @@ def create_reflection(self, name: str, reflection_type: str, anchor: DremioRelat

dataset_id = catalog_info.get("id")

payload = ReflectionEntity(name, reflection_type, dataset_id, display, dimensions, date_dimensions, measures, computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by, arrow_cache).build_payload()
payload = ReflectionEntity(name, reflection_type, dataset_id, display, dimensions, date_dimensions, measures,
computations, partition_by, partition_transform, partition_method, distribute_by,
localsort_by, arrow_cache).build_payload()

dataset_info = rest_client.get_reflections(dataset_id)
reflections_info = dataset_info.get("data")
Expand Down

0 comments on commit 40d40b2

Please sign in to comment.