Skip to content

Commit

Permalink
Merge branch 'main' into chore-update-makefile-add-alembic
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinjosechittilappilly authored Oct 9, 2024
2 parents f7c9606 + 90b2c9d commit e3e16d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
from typing import TYPE_CHECKING
from uuid import UUID, uuid4

from pydantic import field_validator
from pydantic import field_serializer, field_validator
from sqlmodel import JSON, Column, Field, Relationship, SQLModel

if TYPE_CHECKING:
from langflow.services.database.models.flow.model import Flow

from langflow.utils.util_strings import truncate_long_strings


class TransactionBase(SQLModel):
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
Expand All @@ -32,6 +34,10 @@ def validate_flow_id(cls, value):
value = UUID(value)
return value

@field_serializer("outputs")
def serialize_outputs(self, data) -> dict:
return truncate_long_strings(data)


class TransactionTable(TransactionBase, table=True): # type: ignore[call-arg]
__tablename__ = "transaction"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
if TYPE_CHECKING:
from langflow.services.database.models.flow.model import Flow

from langflow.utils.util_strings import truncate_long_strings


class VertexBuildBase(SQLModel):
timestamp: datetime = Field(default_factory=lambda: datetime.now(timezone.utc))
Expand Down Expand Up @@ -39,6 +41,14 @@ def serialize_timestamp(cls, value):
value = value.replace(tzinfo=timezone.utc)
return value

@field_serializer("data")
def serialize_data(self, data: dict) -> dict:
return truncate_long_strings(data)

@field_serializer("artifacts")
def serialize_artifacts(self, data) -> dict:
return truncate_long_strings(data)


class VertexBuildTable(VertexBuildBase, table=True): # type: ignore[call-arg]
__tablename__ = "vertex_build"
Expand Down

0 comments on commit e3e16d8

Please sign in to comment.