@@ -93,7 +93,7 @@ Check out this example of modeling customer data with Redis OM. First, we create
93
93
import datetime
94
94
from typing import Optional
95
95
96
- from pydantic.v1 import EmailStr
96
+ from pydantic import EmailStr
97
97
98
98
from redis_om import HashModel
99
99
@@ -104,7 +104,7 @@ class Customer(HashModel):
104
104
email: EmailStr
105
105
join_date: datetime.date
106
106
age: int
107
- bio: Optional[str ]
107
+ bio: Optional[str ] = None
108
108
```
109
109
110
110
Now that we have a ` Customer ` model, let's use it to save customer data to Redis.
@@ -113,7 +113,7 @@ Now that we have a `Customer` model, let's use it to save customer data to Redis
113
113
import datetime
114
114
from typing import Optional
115
115
116
- from pydantic.v1 import EmailStr
116
+ from pydantic import EmailStr
117
117
118
118
from redis_om import HashModel
119
119
@@ -124,7 +124,7 @@ class Customer(HashModel):
124
124
email: EmailStr
125
125
join_date: datetime.date
126
126
age: int
127
- bio: Optional[str ]
127
+ bio: Optional[str ] = None
128
128
129
129
130
130
# First, we create a new `Customer` object:
@@ -168,7 +168,7 @@ For example, because we used the `EmailStr` type for the `email` field, we'll ge
168
168
import datetime
169
169
from typing import Optional
170
170
171
- from pydantic.v1 import EmailStr, ValidationError
171
+ from pydantic import EmailStr, ValidationError
172
172
173
173
from redis_om import HashModel
174
174
@@ -179,7 +179,7 @@ class Customer(HashModel):
179
179
email: EmailStr
180
180
join_date: datetime.date
181
181
age: int
182
- bio: Optional[str ]
182
+ bio: Optional[str ] = None
183
183
184
184
185
185
try :
@@ -222,7 +222,7 @@ To show how this works, we'll make a small change to the `Customer` model we def
222
222
import datetime
223
223
from typing import Optional
224
224
225
- from pydantic.v1 import EmailStr
225
+ from pydantic import EmailStr
226
226
227
227
from redis_om import (
228
228
Field,
@@ -237,7 +237,7 @@ class Customer(HashModel):
237
237
email: EmailStr
238
238
join_date: datetime.date
239
239
age: int = Field(index = True )
240
- bio: Optional[str ]
240
+ bio: Optional[str ] = None
241
241
242
242
243
243
# Now, if we use this model with a Redis deployment that has the
@@ -287,7 +287,7 @@ from redis_om import (
287
287
288
288
class Address (EmbeddedJsonModel ):
289
289
address_line_1: str
290
- address_line_2: Optional[str ]
290
+ address_line_2: Optional[str ] = None
291
291
city: str = Field(index = True )
292
292
state: str = Field(index = True )
293
293
country: str
0 commit comments