-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(generator): add pydantic_disable_protected_namespaces
config
#983
base: main
Are you sure you want to change the base?
Conversation
Thanks for the PR. Out of curiosity, do you know if renaming those fields would be difficult / not ideal? |
Well I'm not the maintainer of that project, but I'd say it would be difficult because we have a deployment of that software and we have a database with tables with those fields. That said I guess Prisma has migrations and maybe it would take of the renaming, but I don't have a lot of experience with it. The problem is that |
Thanks for the context, I will note that it is possible to rename fields at the client level without causing db migrations :) Granted that in this case, I do wonder if this kind of setting should live on the model instead of the entire generator? @Python(pydantic_disable_protected_namespaces: true)
model LiteLLM_ProxyModelTable {
model_id String @id @default(uuid())
model_name String
litellm_params Json
model_info Json?
created_at DateTime @default(now()) @map("created_at")
created_by String
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
updated_by String
} but I don't feel strongly. |
pydantic_disable_protected_namespaces
config settingpydantic_disable_protected_namespaces
config
Yeah per-model seems nice. I think that would work. |
How would I change this to be per-model? |
We have a Lark grammar for parsing So you'd have to update the I just noticed my original example wouldn't be possible unfortunately, it'd have to be this fwiw /// @Python(pydantic_disable_protected_namespaces: true)
model LiteLLM_ProxyModelTable {
model_id String @id @default(uuid())
model_name String
litellm_params Json
model_info Json?
created_at DateTime @default(now()) @map("created_at")
created_by String
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
updated_by String
} additionally, I appreciate this is more work than you originally signed up for with this PR so I'm happy to take this over the line myself but unfortunately it won't land particularly fast. |
Yeah, you can go ahead and take this over. I'm in no rush for this. Thanks! |
Fixes: GH-982
Change Summary
Adds a
pydantic_disable_protected_namespaces
config setting. When this is true - e.g.: something like this inschema.prisma
:it adds:
to the Pydantic
model_config
.Checklist
Agreement
By submitting this pull request, I confirm that you can use, modify, copy and redistribute this contribution, under the terms of your choice.