parent
b4c20b2f8f
commit
bc2199f2d4
8 changed files with 109 additions and 8 deletions
26
.github/spellcheck-settings.yml
vendored
Normal file
26
.github/spellcheck-settings.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
matrix:
|
||||||
|
- name: Markdown
|
||||||
|
expect_match: false
|
||||||
|
apsell:
|
||||||
|
mode: en
|
||||||
|
dictionary:
|
||||||
|
wordlists:
|
||||||
|
- .github/wordlist.txt
|
||||||
|
output: wordlist.dic
|
||||||
|
encoding: utf-8
|
||||||
|
pipeline:
|
||||||
|
- pyspelling.filters.markdown:
|
||||||
|
markdown_extensions:
|
||||||
|
- markdown.extensions.extra:
|
||||||
|
- pyspelling.filters.html:
|
||||||
|
comments: true
|
||||||
|
attributes:
|
||||||
|
- alt
|
||||||
|
ignores:
|
||||||
|
- ':matches(code, pre)'
|
||||||
|
- 'code'
|
||||||
|
- 'pre'
|
||||||
|
- 'blockquote'
|
||||||
|
sources:
|
||||||
|
- '*.md'
|
||||||
|
- 'docs/*.md'
|
58
.github/wordlist.txt
vendored
Normal file
58
.github/wordlist.txt
vendored
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
APIs
|
||||||
|
Bader's
|
||||||
|
CLI
|
||||||
|
Config
|
||||||
|
Deserializing
|
||||||
|
FastAPI
|
||||||
|
HashModel
|
||||||
|
Homebrew
|
||||||
|
JSON
|
||||||
|
JsonModel
|
||||||
|
MacOS
|
||||||
|
OM's
|
||||||
|
ORM
|
||||||
|
Pipenv
|
||||||
|
PrimaryKeyCreator
|
||||||
|
Pydantic
|
||||||
|
Pydantic
|
||||||
|
Pydantic's
|
||||||
|
README
|
||||||
|
README.md
|
||||||
|
RediSearch
|
||||||
|
RediSearch
|
||||||
|
RedisJSON
|
||||||
|
SQLAlchemy
|
||||||
|
SSL
|
||||||
|
TOC
|
||||||
|
ULIDs
|
||||||
|
UlidPrimaryKey
|
||||||
|
WSL
|
||||||
|
aioredis
|
||||||
|
async
|
||||||
|
asyncio
|
||||||
|
cls
|
||||||
|
coroutines
|
||||||
|
doctoc
|
||||||
|
fastapi
|
||||||
|
indexable
|
||||||
|
io
|
||||||
|
js
|
||||||
|
localhost
|
||||||
|
md
|
||||||
|
migrator
|
||||||
|
py
|
||||||
|
pyenv
|
||||||
|
redis
|
||||||
|
redisearch
|
||||||
|
redisjson
|
||||||
|
rediss
|
||||||
|
runtime
|
||||||
|
sortable
|
||||||
|
subclasses
|
||||||
|
subclassing
|
||||||
|
subscripted
|
||||||
|
unix
|
||||||
|
utf
|
||||||
|
validator
|
||||||
|
validators
|
||||||
|
virtualenv
|
14
.github/workflows/spellcheck.yml
vendored
Normal file
14
.github/workflows/spellcheck.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
name: spellcheck
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
jobs:
|
||||||
|
check-spelling:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Check Spelling
|
||||||
|
uses: rojopolis/spellcheck-github-actions@0.23.0
|
||||||
|
with:
|
||||||
|
config_path: .github/spellcheck-settings.yml
|
||||||
|
task_name: Markdown
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -138,3 +138,6 @@ tests_sync/
|
||||||
|
|
||||||
# Apple Files
|
# Apple Files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# spelling cruft
|
||||||
|
*.dic
|
||||||
|
|
|
@ -52,7 +52,7 @@ Use the "unix" prefix to connect to Redis over Unix domain sockets:
|
||||||
|
|
||||||
### To Learn More
|
### To Learn More
|
||||||
|
|
||||||
To learn more about the URL format that Redis OM Python uses, consult [redis-py's URL documentation](https://redis-py.readthedocs.io/en/stable/#redis.Redis.from_url).
|
To learn more about the URL format that Redis OM Python uses, consult the [redis-py URL documentation](https://redis-py.readthedocs.io/en/stable/#redis.Redis.from_url).
|
||||||
|
|
||||||
**TIP:** The URL format is the same if you're using async or sync mode with Redis OM (i.e., importing `aredis_om` for async or `redis_om` for sync).
|
**TIP:** The URL format is the same if you're using async or sync mode with Redis OM (i.e., importing `aredis_om` for async or `redis_om` for sync).
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ This example shows how to manage these two uses of Redis within the same applica
|
||||||
|
|
||||||
Let's look at an example FastAPI app that uses Redis OM.
|
Let's look at an example FastAPI app that uses Redis OM.
|
||||||
|
|
||||||
**NOTE**: This example code requires dependencies to run. To install the dependencies, first clone the [redis-om-fastapi](https://github.com/redis-developer/redis-om-fastapi) repository from GitHub. Then follow the installation steps later in this document or in that repository's README.md file.
|
**NOTE**: This example code requires dependencies to run. To install the dependencies, first clone the [redis-om-fastapi](https://github.com/redis-developer/redis-om-fastapi) repository from GitHub. Then follow the installation steps later in this document or in that repository's README.md file.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -131,7 +131,7 @@ Get a copy of the value for "pk," which is the model's primary key, and make ano
|
||||||
$ curl "http://localhost:8000/customer/01FM2G8EP38AVMH7PMTAJ123TA"
|
$ curl "http://localhost:8000/customer/01FM2G8EP38AVMH7PMTAJ123TA"
|
||||||
{"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"a@example.com","join_date":"2020-01-02","age":38,"bio":""}
|
{"pk":"01FM2G8EP38AVMH7PMTAJ123TA","first_name":"Andrew","last_name":"Brookins","email":"a@example.com","join_date":"2020-01-02","age":38,"bio":""}
|
||||||
|
|
||||||
You can also get a list of all customer PKs:
|
You can also get a list of all customer primary keys:
|
||||||
|
|
||||||
$ curl "http://localhost:8000/customers"
|
$ curl "http://localhost:8000/customers"
|
||||||
{"customers":["01FM2G8EP38AVMH7PMTAJ123TA"]}
|
{"customers":["01FM2G8EP38AVMH7PMTAJ123TA"]}
|
||||||
|
|
|
@ -17,7 +17,7 @@ python --version
|
||||||
Python 3.7.0
|
Python 3.7.0
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't have Python installed, you can download it from [Python.org](https://www.python.org/downloads/), use [Pyenv](https://github.com/pyenv/pyenv), or install Python with your operating system's package manager.
|
If you don't have Python installed, you can download it from [Python.org](https://www.python.org/downloads/), use [pyenv](https://github.com/pyenv/pyenv), or install Python with your operating system's package manager.
|
||||||
|
|
||||||
## Redis
|
## Redis
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ Otherwise, you can start the server manually:
|
||||||
|
|
||||||
$ redis-server start
|
$ redis-server start
|
||||||
|
|
||||||
### macOS with Homebrew
|
### MacOS with Homebrew
|
||||||
|
|
||||||
$ brew services start redis
|
$ brew services start redis
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ type(andrew.join_date)
|
||||||
# > datetime.date # The model parsed the string automatically!
|
# > datetime.date # The model parsed the string automatically!
|
||||||
```
|
```
|
||||||
|
|
||||||
This ability to combine parsing (in this case, a YYYY-MM-DD date string) with validation can save you a lot of work.
|
This ability to combine parsing (in this case, a date string) with validation can save you a lot of work.
|
||||||
|
|
||||||
However, you can turn off coercion -- check the next section on using strict validation.
|
However, you can turn off coercion -- check the next section on using strict validation.
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ Customer.find(Customer.last_name == "Brookins").all()
|
||||||
# Find all customers that do NOT have the last name "Brookins"
|
# Find all customers that do NOT have the last name "Brookins"
|
||||||
Customer.find(Customer.last_name != "Brookins").all()
|
Customer.find(Customer.last_name != "Brookins").all()
|
||||||
|
|
||||||
# Find all customers whose last name is "Brookins" OR whose age is
|
# Find all customers whose last name is "Brookins" OR whose age is
|
||||||
# 100 AND whose last name is "Smith"
|
# 100 AND whose last name is "Smith"
|
||||||
Customer.find((Customer.last_name == "Brookins") | (
|
Customer.find((Customer.last_name == "Brookins") | (
|
||||||
Customer.age == 100
|
Customer.age == 100
|
||||||
|
|
|
@ -131,7 +131,7 @@ Once again, we get the validation error:
|
||||||
|
|
||||||
## Constrained Values
|
## Constrained Values
|
||||||
|
|
||||||
If you want to use any of the constr
|
If you want to use any of the constraints.
|
||||||
|
|
||||||
Pydantic includes many type annotations to introduce constraints to your model field values.
|
Pydantic includes many type annotations to introduce constraints to your model field values.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue