From 84e194536a5045c7e6d093d26bde4d752dd6af25 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 18 Apr 2024 16:37:49 -0400 Subject: [PATCH] blockchain column handles int args --- src/dexorder/database/column_types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dexorder/database/column_types.py b/src/dexorder/database/column_types.py index 4367361..b06cd12 100644 --- a/src/dexorder/database/column_types.py +++ b/src/dexorder/database/column_types.py @@ -1,5 +1,6 @@ import dataclasses import math +from typing import Union from sqlalchemy import TypeDecorator, BIGINT from sqlalchemy.dialects.postgresql import BYTEA, JSONB @@ -24,8 +25,8 @@ class Blockchain(TypeDecorator): impl = BIGINT cache_ok = True - def process_bind_param(self, value: NativeBlockchain, dialect): - return value.id + def process_bind_param(self, value: Union[NativeBlockchain,int], dialect): + return value if type(value) is int else value.id def process_result_value(self, value: int, dialect): return NativeBlockchain.for_id(value)