diff --git a/src/prisma/generator/models.py b/src/prisma/generator/models.py index 99a0d9878..687c8015f 100644 --- a/src/prisma/generator/models.py +++ b/src/prisma/generator/models.py @@ -506,6 +506,8 @@ class Config(BaseSettings): # https://github.com/prisma/prisma/issues/12442 enable_experimental_decimal: bool = FieldInfo(default=False, env='PRISMA_PY_CONFIG_ENABLE_EXPERIMENTAL_DECIMAL') + pydantic_disable_protected_namespaces: bool = False + # this seems to be the only good method for setting the contextvar as # we don't control the actual construction of the object like we do for # the Data model. diff --git a/src/prisma/generator/templates/bases.py.jinja b/src/prisma/generator/templates/bases.py.jinja index d0ce43165..17a957707 100644 --- a/src/prisma/generator/templates/bases.py.jinja +++ b/src/prisma/generator/templates/bases.py.jinja @@ -21,6 +21,9 @@ class _PrismaModel(BaseModel): use_enum_values=True, arbitrary_types_allowed=True, populate_by_name=True, +{% if generator.config.pydantic_disable_protected_namespaces %} + protected_namespaces=(), +{% endif %} ) elif not TYPE_CHECKING: from ._compat import BaseConfig