We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e97c93 commit 1e3359aCopy full SHA for 1e3359a
sqlmodel/main.py
@@ -323,7 +323,7 @@ def __init__(
323
# triggers an error
324
base_is_table = False
325
for base in bases:
326
- config = getattr(base, "__config__")
+ config = getattr(base, "__config__", None)
327
if config and getattr(config, "table", False):
328
base_is_table = True
329
break
tests/test_mixin.py
@@ -0,0 +1,17 @@
1
+from typing import Optional
2
+
3
+import pytest
4
+from sqlmodel import Field, SQLModel
5
6
7
+class FooMixin:
8
+ pass
9
10
11
+@pytest.mark.usefixtures("clear_sqlmodel")
12
+def test_mixin():
13
+ class Hero(FooMixin, SQLModel, table=True):
14
+ id: Optional[int] = Field(default=None, primary_key=True)
15
+ name: str
16
+ secret_name: str
17
+ age: Optional[int] = None
0 commit comments