Skip to content

Commit

Permalink
Add pydantic_disable_protected_namespaces to Config
Browse files Browse the repository at this point in the history
  • Loading branch information
msabramo committed Jul 24, 2024
1 parent 56d4af4 commit e7126ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/prisma/generator/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/prisma/generator/templates/bases.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7126ba

Please sign in to comment.