Skip to content

Commit

Permalink
fix model_config SQLModel (#3457)
Browse files Browse the repository at this point in the history
* fix model_config SQLModel

* added comment
  • Loading branch information
Hk669 authored Sep 1, 2024
1 parent 4577524 commit ca1a89c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion samples/apps/autogen-studio/autogenstudio/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@
Enum as SqlEnum,
)

SQLModel.model_config["protected_namespaces"] = ()
# added for python3.11 and sqlmodel 0.0.22 incompatibility
if hasattr(SQLModel, "model_config"):
SQLModel.model_config["protected_namespaces"] = ()
elif hasattr(SQLModel, "Config"):

class CustomSQLModel(SQLModel):
class Config:
protected_namespaces = ()

SQLModel = CustomSQLModel
else:
print("Warning: Unable to set protected_namespaces.")

# pylint: disable=protected-access


Expand Down

0 comments on commit ca1a89c

Please sign in to comment.