FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix enums converting by deknowny · Pull Request #197 · fastapi/sqlmodel · GitHub

Repository navigation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
7 changes: 4 additions & 3 deletions sqlmodel/main.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ipaddress
import uuid
import weakref
import enum
from datetime import date, datetime, time, timedelta
from decimal import Decimal
from enum import Enum
from pathlib import Path
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -42,6 +42,7 @@
Interval,
Numeric,
inspect,
Enum
)
from sqlalchemy.orm import RelationshipProperty, declared_attr, registry, relationship
from sqlalchemy.orm.attributes import set_attribute
Expand Down Expand Up @@ -394,8 +395,8 @@ def get_sqlachemy_type(field: ModelField) -> Any:
return Interval
if issubclass(field.type_, time):
return Time
if issubclass(field.type_, Enum):
return Enum
if issubclass(field.type_, enum.Enum):
return Enum(field.type_)
if issubclass(field.type_, bytes):
return LargeBinary
if issubclass(field.type_, Decimal):
Expand Down

Back | FazBrowse Home | New Git URL