blockchain column handles int args

This commit is contained in:
Tim
2024-04-18 16:37:49 -04:00
parent e9779d3338
commit 84e194536a

View File

@@ -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)