You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ariadne has been very useful for our team which uses GraphQL backed by Python services.
When we add new fields to a type, existing records in our underlying database (DynamoDB) do not have the new attribute - so we run into a ValidationError (missing) when creating a Python object with newly generated Pydantic model. The fix for this would be to add the default = None for attributes that are Optional, which allows creation of the model class instance to continue even if the new attribute is not in the old record.
Is there already a way to do this that we're not leveraging properly?
# In schema.graphql which is our config `schema_path`typeLocation {
locationId: ID!parentId: IDname: String
}
# In queries.graphql which is our config `queries_path`fragmentLocationonLocation {
locationIdparentIdname
}
Ariadne has been very useful for our team which uses GraphQL backed by Python services.
When we add new fields to a type, existing records in our underlying database (DynamoDB) do not have the new attribute - so we run into a ValidationError (missing) when creating a Python object with newly generated Pydantic model. The fix for this would be to add the default
= None
for attributes that areOptional
, which allows creation of the model class instance to continue even if the new attribute is not in the old record.Is there already a way to do this that we're not leveraging properly?
After running codegen we get:
We'd like:
The text was updated successfully, but these errors were encountered: