diff --git a/sqlmodel/main.py b/sqlmodel/main.py index 08eaf5956f..0b9bff3bde 100644 --- a/sqlmodel/main.py +++ b/sqlmodel/main.py @@ -151,7 +151,8 @@ def Field( primary_key: bool = False, foreign_key: Optional[Any] = None, nullable: Union[bool, UndefinedType] = Undefined, - index: Union[bool, UndefinedType] = Undefined, + # NOTE: Undefined not propagating well to postgres - explicitly set False + index: Union[bool, UndefinedType] = False, sa_column: Union[Column, UndefinedType] = Undefined, # type: ignore sa_column_args: Union[Sequence[Any], UndefinedType] = Undefined, sa_column_kwargs: Union[Mapping[str, Any], UndefinedType] = Undefined, diff --git a/sqlmodel/sql/sqltypes.py b/sqlmodel/sql/sqltypes.py index b3fda87739..a9f53ad286 100644 --- a/sqlmodel/sql/sqltypes.py +++ b/sqlmodel/sql/sqltypes.py @@ -47,10 +47,10 @@ def process_bind_param(self, value: Any, dialect: Dialect) -> Optional[str]: return str(value) else: if not isinstance(value, uuid.UUID): - return f"{uuid.UUID(value).int:x}" + return uuid.UUID(value).hex else: # hexstring - return f"{value.int:x}" + return value.hex def process_result_value(self, value: Any, dialect: Dialect) -> Optional[uuid.UUID]: if value is None: