diff --git a/asyncdb/drivers/pg.py b/asyncdb/drivers/pg.py index 4ef416c0..1454f6ad 100644 --- a/asyncdb/drivers/pg.py +++ b/asyncdb/drivers/pg.py @@ -6,6 +6,7 @@ """ import asyncio +from enum import Enum import os import ssl import time @@ -1178,6 +1179,8 @@ async def _insert_(self, _model: Model, **kwargs): # pylint: disable=W0613 value = getattr(value, name) except AttributeError: value = None + elif isinstance(value, Enum): + value = value.value source.append(value) cols.append(column) n += 1 @@ -1299,6 +1302,8 @@ async def _update_(self, _model: Model, **kwargs): # pylint: disable=W0613 value = getattr(value, name) except AttributeError: value = None + elif isinstance(value, Enum): + value = value.value cols.append("{} = {}".format(name, "${}".format(n))) # pylint: disable=C0209 source.append(value) n += 1 diff --git a/asyncdb/interfaces/model.py b/asyncdb/interfaces/model.py index c0f24e2e..86df743c 100644 --- a/asyncdb/interfaces/model.py +++ b/asyncdb/interfaces/model.py @@ -1,3 +1,4 @@ +from enum import Enum from typing import Any, List from abc import ABC, abstractmethod import uuid @@ -122,6 +123,8 @@ def _get_value(self, field: Field, value: Any) -> Any: new_val = None elif callable(datatype) and value is None: new_val = None + elif isinstance(value, Enum): + new_val = value.value else: new_val = value return new_val diff --git a/asyncdb/version.py b/asyncdb/version.py index 3b4d05be..ad1fb9d7 100644 --- a/asyncdb/version.py +++ b/asyncdb/version.py @@ -3,7 +3,7 @@ __title__ = "asyncdb" __description__ = "Library for Asynchronous data source connections \ Collection of asyncio drivers." -__version__ = "2.9.9" +__version__ = "2.9.10" __author__ = "Jesus Lara" __author_email__ = "jesuslarag@gmail.com" __license__ = "BSD" diff --git a/setup.py b/setup.py index d3edafb4..23472048 100644 --- a/setup.py +++ b/setup.py @@ -194,7 +194,8 @@ def readme(): "aioboto3==13.2.0" ], "bigquery": [ - "google-cloud-bigquery==3.25.0", + "google-cloud-bigquery==3.27.0", + "google-cloud-bigquery-storage==2.27.0", "pandas-gbq==0.24.0", "google-cloud-storage>=2.17.0" ],