Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmeireles committed Jan 3, 2025
1 parent b8e549d commit 2a02b00
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 24 deletions.
7 changes: 4 additions & 3 deletions dbt/adapters/dremio/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
# limitations under the License.

import agate
from typing import Tuple, Optional
from typing import Tuple, Optional, List
from contextlib import contextmanager

from dbt.adapters.dremio.api.cursor import DremioCursor
from dbt.adapters.dremio.api.handle import DremioHandle
from dbt.adapters.dremio.api.parameters import ParametersBuilder
from dbt.adapters.dremio.relation import DremioRelation

from dbt_common.clients import agate_helper

Expand Down Expand Up @@ -230,8 +231,8 @@ def create_catalog(self, relation):
self._create_folders(database, schema, rest_client)
return

def dbt_reflection_integration(self, name: str, type: str, anchor, display, dimensions, date_dimensions, measures,
computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by, arrow_cache):
def dbt_reflection_integration(self, name: str, 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: List[str], distribute_by: List[str], localsort_by: List[str], arrow_cache: bool):
thread_connection = self.get_thread_connection()
connection = self.open(thread_connection)
rest_client = connection.handle.get_client()
Expand Down
2 changes: 1 addition & 1 deletion dbt/adapters/dremio/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def run_sql_for_tests(self, sql, fetch, conn):
conn.transaction_open = False

@available
def dbt_reflection_integration(self, name: str, type: str, anchor, display, dimensions, date_dimensions, measures, computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by, arrow_cache) -> None:
def dbt_reflection_integration(self, name: str, 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: List[str], distribute_by: List[str], localsort_by: List[str], arrow_cache: bool) -> None:
self.connections.dbt_reflection_integration(name, type, anchor, display, dimensions, date_dimensions, measures, computations, partition_by, partition_transform, partition_method, distribute_by, localsort_by, arrow_cache)


Expand Down
10 changes: 5 additions & 5 deletions dbt/include/dremio/macros/adapters/metadata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ limitations under the License.*/
{%- endmacro -%}

{% macro dremio__get_catalog_relations_result_sql(relations) %}
select *
from t
join columns on (t.table_schema = columns.table_schema
and t.table_name = columns.table_name)
order by "column_index"
select *
from t
join columns on (t.table_schema = columns.table_schema
and t.table_name = columns.table_name)
order by "column_index"
{%- endmacro -%}

{% macro get_catalog_reflections(relations) %}
Expand Down
17 changes: 2 additions & 15 deletions tests/functional/adapter/dremio_specific/test_reflections.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,8 @@

class TestReflectionsDremio:
@pytest.fixture(scope="class")
def client(self):
OPTIONS = {'user': 'dremio', 'object_storage_source': '$scratch', 'object_storage_path': 'no_schema',
'dremio_space': '@user', 'dremio_space_folder': 'no_schema', 'threads': 1, 'software_host': 'localhost',
'port': 9047, 'use_ssl': False, 'password': 'dremio123'}

credentials = DremioCredentials()
credentials.UID = OPTIONS['user']
credentials.PWD = OPTIONS['password']
credentials.software_host = OPTIONS['software_host']
credentials.port = OPTIONS['port']
credentials.use_ssl = OPTIONS['use_ssl']
credentials.object_storage_source = OPTIONS['object_storage_source']
credentials.object_storage_path = OPTIONS['object_storage_path']
credentials.dremio_space = OPTIONS['dremio_space']
credentials.dremio_space_folder = OPTIONS['dremio_space_folder']
def client(self, adapter):
credentials = adapter.connections.profile.credentials

parameters = ParametersBuilder.build(credentials)
client = DremioRestClient(parameters.get_parameters())
Expand Down

0 comments on commit 2a02b00

Please sign in to comment.