Skip to content

Commit

Permalink
fix: manage init error when using Identity columns
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kondr01 committed Aug 8, 2024
1 parent 1bc0329 commit d0fde0d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fastapi_sqlalchemy_toolkit/model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ def __init__(
if hasattr(attr, "default") and attr.default is not None:
if isinstance(attr.default, ScalarElementColumnDefault):
self.defaults[attr_name] = attr.default.arg
elif hasattr(attr, "server_default") and attr.server_default is not None:
elif (
hasattr(attr, "server_default")
and attr.server_default is not None
and hasattr(attr.server_default, "arg")
):
if isinstance(attr.type, BOOLEAN):
self.defaults[attr_name] = attr.server_default.arg != "False"
elif isinstance(attr.type, Integer):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "fastapi_sqlalchemy_toolkit"
version = "0.7.5.1"
version = "0.7.6"
authors = [
{ name="Egor Kondrashov", email="[email protected]" },
]
Expand Down

0 comments on commit d0fde0d

Please sign in to comment.