From b40553c5d7712c47331878b2d4e20bcaa8ed8e00 Mon Sep 17 00:00:00 2001 From: serramatutu Date: Wed, 2 Oct 2024 15:51:56 +0200 Subject: [PATCH] fixup! refactor: typing public interfaces with order by --- dbtsl/api/graphql/client/asyncio.pyi | 10 +++++----- dbtsl/api/graphql/client/sync.pyi | 10 +++++----- dbtsl/client/asyncio.pyi | 10 +++++----- dbtsl/client/sync.pyi | 10 +++++----- tests/integration/test_sl_client.py | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dbtsl/api/graphql/client/asyncio.pyi b/dbtsl/api/graphql/client/asyncio.pyi index 052dc32..7006af2 100644 --- a/dbtsl/api/graphql/client/asyncio.pyi +++ b/dbtsl/api/graphql/client/asyncio.pyi @@ -4,7 +4,7 @@ from typing import List, Optional, Self, Union import pyarrow as pa from typing_extensions import AsyncIterator, Unpack, overload -from dbtsl.api.shared.query_params import OrderByDimension, OrderByMetric, QueryParameters +from dbtsl.api.shared.query_params import OrderByGroupBy, OrderByMetric, QueryParameters from dbtsl.models import ( Dimension, Entity, @@ -50,7 +50,7 @@ class AsyncGraphQLClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -59,7 +59,7 @@ class AsyncGraphQLClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -73,7 +73,7 @@ class AsyncGraphQLClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... @@ -82,7 +82,7 @@ class AsyncGraphQLClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... diff --git a/dbtsl/api/graphql/client/sync.pyi b/dbtsl/api/graphql/client/sync.pyi index a657769..c424dc0 100644 --- a/dbtsl/api/graphql/client/sync.pyi +++ b/dbtsl/api/graphql/client/sync.pyi @@ -4,7 +4,7 @@ from typing import Iterator, List, Optional, Union import pyarrow as pa from typing_extensions import Self, Unpack, overload -from dbtsl.api.shared.query_params import OrderByDimension, OrderByMetric, QueryParameters +from dbtsl.api.shared.query_params import OrderByGroupBy, OrderByMetric, QueryParameters from dbtsl.models import ( Dimension, Entity, @@ -50,7 +50,7 @@ class SyncGraphQLClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -59,7 +59,7 @@ class SyncGraphQLClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -73,7 +73,7 @@ class SyncGraphQLClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... @@ -82,7 +82,7 @@ class SyncGraphQLClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... diff --git a/dbtsl/client/asyncio.pyi b/dbtsl/client/asyncio.pyi index 5a50a3c..08a78f2 100644 --- a/dbtsl/client/asyncio.pyi +++ b/dbtsl/client/asyncio.pyi @@ -4,7 +4,7 @@ from typing import AsyncIterator, List, Optional, Union import pyarrow as pa from typing_extensions import Self, Unpack, overload -from dbtsl.api.shared.query_params import OrderByDimension, OrderByMetric, QueryParameters +from dbtsl.api.shared.query_params import OrderByGroupBy, OrderByMetric, QueryParameters from dbtsl.models import Dimension, Entity, Measure, Metric, SavedQuery class AsyncSemanticLayerClient: @@ -20,7 +20,7 @@ class AsyncSemanticLayerClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -29,7 +29,7 @@ class AsyncSemanticLayerClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -43,7 +43,7 @@ class AsyncSemanticLayerClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... @@ -52,7 +52,7 @@ class AsyncSemanticLayerClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... diff --git a/dbtsl/client/sync.pyi b/dbtsl/client/sync.pyi index ddf8ca2..1b0f577 100644 --- a/dbtsl/client/sync.pyi +++ b/dbtsl/client/sync.pyi @@ -4,7 +4,7 @@ from typing import Iterator, List, Optional, Union import pyarrow as pa from typing_extensions import Self, Unpack, overload -from dbtsl.api.shared.query_params import OrderByDimension, OrderByMetric, QueryParameters +from dbtsl.api.shared.query_params import OrderByGroupBy, OrderByMetric, QueryParameters from dbtsl.models import Dimension, Entity, Measure, Metric, SavedQuery class SyncSemanticLayerClient: @@ -20,7 +20,7 @@ class SyncSemanticLayerClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -29,7 +29,7 @@ class SyncSemanticLayerClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> str: ... @@ -43,7 +43,7 @@ class SyncSemanticLayerClient: metrics: List[str], group_by: Optional[List[str]] = None, limit: Optional[int] = None, - order_by: Optional[List[Union[str, OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[str, OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... @@ -52,7 +52,7 @@ class SyncSemanticLayerClient: self, saved_query: str, limit: Optional[int] = None, - order_by: Optional[List[Union[OrderByDimension, OrderByMetric]]] = None, + order_by: Optional[List[Union[OrderByGroupBy, OrderByMetric]]] = None, where: Optional[List[str]] = None, read_cache: bool = True, ) -> "pa.Table": ... diff --git a/tests/integration/test_sl_client.py b/tests/integration/test_sl_client.py index 3690cad..343a073 100644 --- a/tests/integration/test_sl_client.py +++ b/tests/integration/test_sl_client.py @@ -3,7 +3,7 @@ import pytest from pytest_subtests import SubTests -from dbtsl import OrderByDimension +from dbtsl import OrderByGroupBy from dbtsl.client.asyncio import AsyncSemanticLayerClient from dbtsl.client.base import ADBC, GRAPHQL from dbtsl.client.sync import SyncSemanticLayerClient @@ -106,7 +106,7 @@ async def test_client_query_saved_query(api: str, client: BothClients) -> None: table = await maybe_await( client.query( saved_query="order_metrics", - order_by=[OrderByDimension(name="metric_time", grain=None)], + order_by=[OrderByGroupBy(name="metric_time", grain=None)], where=["1=1"], limit=1, read_cache=True, @@ -140,7 +140,7 @@ async def test_client_compile_sql_saved_query(client: BothClients) -> None: sql = await maybe_await( client.compile_sql( saved_query="order_metrics", - order_by=[OrderByDimension(name="metric_time", grain=None)], + order_by=[OrderByGroupBy(name="metric_time", grain=None)], where=["1=1"], limit=1, read_cache=True,