Merge pull request #20 from FlipsideCrypto/fix_filter_issue

Python SDK: Fix filter issue
This commit is contained in:
Jim Myers 2023-05-25 22:48:14 -04:00 committed by GitHub
commit db3160817a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 23 deletions

View File

@ -19,6 +19,6 @@ Get your [free API key here](https://flipsidecrypto.xyz/account/api-keys)
| Language | Version | Status |
| ------------------------ | ------- | ---------------------------------------------------------------------------------- |
| ✅ [Python](./python/) | 2.0.4 | [![tests](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_python.yml/badge.svg)](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_python.yml) |
| ✅ [Python](./python/) | 2.0.7 | [![tests](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_python.yml/badge.svg)](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_python.yml) |
| ✅ [JS/TypeScript](./js) | 2.0.0 | [![tests](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_js.yml/badge.svg)](https://github.com/FlipsideCrypto/sdk/actions/workflows/ci_js.yml)
| ✅ [R](./r/shroomDK/) | Under Construction | |

View File

@ -1 +1 @@
2.0.5
2.0.7

View File

@ -159,19 +159,19 @@ class CompassQueryIntegration(object):
filters: Optional[Union[List[Filter], None]] = [],
sort_by: Optional[Union[List[SortBy], None]] = [],
) -> GetQueryRunResultsRpcResult:
query_results_resp = self.rpc.get_query_result(
GetQueryRunResultsRpcParams(
queryRunId=query_run_id,
format=ResultFormat.csv,
page=Page(
number=page_number,
size=page_size,
),
filters=filters,
sortBy=sort_by,
)
params = GetQueryRunResultsRpcParams(
queryRunId=query_run_id,
format=ResultFormat.csv,
page=Page(
number=page_number,
size=page_size,
),
filters=filters,
sortBy=sort_by,
)
query_results_resp = self.rpc.get_query_result(params)
if query_results_resp.error:
raise get_exception_by_error_code(
error_code=query_results_resp.error.code

View File

@ -13,22 +13,25 @@ from .core.rpc_response import RpcResponse
# Request
class Filter(BaseModel):
column: str
eq: Optional[str] = None
neq: Optional[str] = None
gt: Optional[str] = None
gte: Optional[str] = None
lt: Optional[str] = None
lte: Optional[str] = None
like: Optional[str] = None
in_: Optional[List[str]] = None
notIn: Optional[List[str]] = None
eq: Optional[Any] = None
neq: Optional[Any] = None
gt: Optional[Any] = None
gte: Optional[Any] = None
lt: Optional[Any] = None
lte: Optional[Any] = None
like: Optional[Any] = None
in_: Optional[List[Any]] = None
notIn: Optional[List[Any]] = None
class Config:
fields = {"in_": "in"}
def dict(self, *args, **kwargs) -> dict:
kwargs.setdefault("exclude_none", True) # Exclude keys with None values
return super().dict(*args, **kwargs)
result = super().dict(*args, **kwargs)
if "in_" in result:
result["in"] = result.pop("in_") # convert 'in_' back to 'in'
return result
class SortBy(BaseModel):