Skip to content

Commit

Permalink
fix: catch deprecation warnings in GQL client
Browse files Browse the repository at this point in the history
We are raising deprecation warnings from the GQL client when we
instantiate the models. To avoid the warning spam, we filter those
warnings out. They should only be display if the user uses any
deprecated class, not us.
  • Loading branch information
serramatutu committed Oct 17, 2024
1 parent d34961f commit ccd5cde
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions dbtsl/api/graphql/client/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
import warnings
from abc import abstractmethod
from typing import Any, Dict, Generic, Optional, Protocol, TypeVar, Union

Expand Down Expand Up @@ -102,10 +103,12 @@ def __getattr__(self, attr: str) -> Any:
if op is None:
raise AttributeError()

return functools.partial(
self._run,
op=op,
)
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
return functools.partial(
self._run,
op=op,
)


TClient = TypeVar("TClient", bound=BaseGraphQLClient, covariant=True)
Expand Down

0 comments on commit ccd5cde

Please sign in to comment.