blockchain column handles int args
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user