Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: redis/redis-om-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.1
Choose a base ref
...
head repository: redis/redis-om-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refs/heads/main
Choose a head ref

Commits on May 31, 2024

  1. Copy the full SHA
    44cbeaf View commit details

Commits on Jul 10, 2024

  1. fixing schema parsing in json models with non-str pks (#622)

    Co-authored-by: Savannah Norem <savannah.norem@redis.com>
    slorello89 and Savannah Norem authored Jul 10, 2024
    Copy the full SHA
    dda2897 View commit details
  2. Make RedisModel compatible with Pydantic 2.x (#626)

    * Make RedisModel compatible with Pydantic 2.x
    
    * Use direct import of ConfigDict instead of conditionally exporting it from _compat
    
    * Refactor to use PYDANTIC_V2 from _compat
    arareko authored Jul 10, 2024
    Copy the full SHA
    b20e887 View commit details

Commits on Aug 2, 2024

  1. supporting literals as tag type (#635)

    * supporting literals as tag type
    
    * fixing key-prefix issue
    slorello89 authored Aug 2, 2024
    Copy the full SHA
    f245488 View commit details

Commits on Aug 5, 2024

  1. Test the FindQuery class and how it turns expressions into Redis comm…

    …ands (#642)
    
    * added return_fields function, attempting to optionally limit fields returned by find
    
    * added call to get query, adding tests
    
    * cleaned up test file, added endswith test
    
    * cleaned up one more return fields line, added fuzzy matching and cleaned up some tests
    
    * remove changes - return_fields doesn't exist here, that'll be it's own branch
    
    * removing whitespace from blank lines for linter
    
    * fixing linter issues
    
    * ignorning erroneous error
    
    * making xfix tests more specific
    
    * linting fixes
    
    * removing validate return fields function as return_fields don't exist here
    
    ---------
    
    Co-authored-by: slorello89 <steve.lorello@redis.com>
    Savannah Norem and slorello89 authored Aug 5, 2024
    Copy the full SHA
    424b842 View commit details

Commits on Aug 6, 2024

  1. Update setuptools requirement from ^69.2.0 to >=69.2,<73.0 (#641)

    Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version.
    - [Release notes](https://github.com/pypa/setuptools/releases)
    - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
    - [Commits](pypa/setuptools@v69.2.0...v72.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: setuptools
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    dependabot[bot] and slorello89 authored Aug 6, 2024
    Copy the full SHA
    e0d62fb View commit details
  2. Update hiredis requirement from ^2.2.3 to >=2.2.3,<4.0.0 (#638)

    Updates the requirements on [hiredis](https://github.com/redis/hiredis-py) to permit the latest version.
    - [Release notes](https://github.com/redis/hiredis-py/releases)
    - [Changelog](https://github.com/redis/hiredis-py/blob/master/CHANGELOG.md)
    - [Commits](redis/hiredis-py@v2.2.3...v3.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: hiredis
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Aug 6, 2024
    Copy the full SHA
    173f971 View commit details
  3. Bump rojopolis/spellcheck-github-actions from 0.36.0 to 0.40.0 (#639)

    Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.36.0 to 0.40.0.
    - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
    - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
    - [Commits](rojopolis/spellcheck-github-actions@0.36.0...0.40.0)
    
    ---
    updated-dependencies:
    - dependency-name: rojopolis/spellcheck-github-actions
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    dependabot[bot] and slorello89 authored Aug 6, 2024
    Copy the full SHA
    1f04341 View commit details
  4. Update unasync requirement from ^0.5.0 to ^0.6.0 (#621)

    Updates the requirements on [unasync](https://github.com/python-trio/unasync) to permit the latest version.
    - [Release notes](https://github.com/python-trio/unasync/releases)
    - [Commits](python-trio/unasync@v0.5.0...v0.6.0)
    
    ---
    updated-dependencies:
    - dependency-name: unasync
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    dependabot[bot] and slorello89 authored Aug 6, 2024
    Copy the full SHA
    278ee0c View commit details
  5. Update pytest-cov requirement from ^4.0.0 to ^5.0.0 (#620)

    Updates the requirements on [pytest-cov](https://github.com/pytest-dev/pytest-cov) to permit the latest version.
    - [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
    - [Commits](pytest-dev/pytest-cov@v4.0.0...v5.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: pytest-cov
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    dependabot[bot] and slorello89 authored Aug 6, 2024
    Copy the full SHA
    f4af84d View commit details
  6. bumping to setuptools-70 (#644)

    setuptools-70
    slorello89 authored Aug 6, 2024
    Copy the full SHA
    3233ce6 View commit details
  7. revving to 0.3.2 (#645)

    slorello89 authored Aug 6, 2024
    Copy the full SHA
    c5068e5 View commit details

Commits on Oct 30, 2024

  1. fixing broken Pydantic v1 regression (#663)

    * fixing broken Pydantic v1 regression
    
    * mypy thing
    slorello89 authored Oct 30, 2024
    Copy the full SHA
    2455394 View commit details

Commits on Nov 4, 2024

  1. Bump rojopolis/spellcheck-github-actions from 0.40.0 to 0.44.0 (#665)

    Bumps [rojopolis/spellcheck-github-actions](https://github.com/rojopolis/spellcheck-github-actions) from 0.40.0 to 0.44.0.
    - [Release notes](https://github.com/rojopolis/spellcheck-github-actions/releases)
    - [Changelog](https://github.com/rojopolis/spellcheck-github-actions/blob/master/CHANGELOG.md)
    - [Commits](rojopolis/spellcheck-github-actions@0.40.0...0.44.0)
    
    ---
    updated-dependencies:
    - dependency-name: rojopolis/spellcheck-github-actions
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    dependabot[bot] and slorello89 authored Nov 4, 2024
    Copy the full SHA
    abc33aa View commit details
  2. Update setuptools requirement from >=70.0,<73.0 to >=70.0,<76.0 (#655)

    Updates the requirements on [setuptools](https://github.com/pypa/setuptools) to permit the latest version.
    - [Release notes](https://github.com/pypa/setuptools/releases)
    - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
    - [Commits](pypa/setuptools@v70.0.0...v75.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: setuptools
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 4, 2024
    Copy the full SHA
    5156171 View commit details
  3. Update pytest-asyncio requirement from ^0.23.5 to ^0.24.0 (#651)

    Updates the requirements on [pytest-asyncio](https://github.com/pytest-dev/pytest-asyncio) to permit the latest version.
    - [Release notes](https://github.com/pytest-dev/pytest-asyncio/releases)
    - [Commits](pytest-dev/pytest-asyncio@v0.23.5...v0.24.0)
    
    ---
    updated-dependencies:
    - dependency-name: pytest-asyncio
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Nov 4, 2024
    Copy the full SHA
    7bfd6b2 View commit details
  4. revving 0.3.3 (#667)

    slorello89 authored Nov 4, 2024
    Copy the full SHA
    6b521d5 View commit details

Commits on Nov 27, 2024

  1. Fix: Incorrect Query Prefixing for Embedded Models in Query Construct…

    …ion (#657)
    
    * Correct query prefixing for embedded models to prevent field concatenation
    
    * keeping linter happy, adding test
    
    ---------
    
    Co-authored-by: Steve Lorello <42971704+slorello89@users.noreply.github.com>
    Co-authored-by: slorello89 <steve.lorello@redis.com>
    3 people authored Nov 27, 2024
    Copy the full SHA
    d0e3a68 View commit details

Commits on Jan 14, 2025

  1. fixing issue with inhereted defaults (#673)

    * fixing issue with inhereted defaults
    slorello89 authored Jan 14, 2025
    Copy the full SHA
    758d9c7 View commit details

Commits on Jan 17, 2025

  1. Copy the full SHA
    82406f0 View commit details

Commits on Feb 20, 2025

  1. fix logo (#681)

    abrookins authored Feb 20, 2025
    Copy the full SHA
    5958ab1 View commit details

Commits on Apr 2, 2025

  1. revving to 0.3.4 (#684)

    slorello89 authored Apr 2, 2025
    Copy the full SHA
    a9b1037 View commit details
  2. Fixing poetry in CI (#685)

    * fixing petry in publish CI
    slorello89 authored Apr 2, 2025
    Copy the full SHA
    a5b1c8b View commit details
  3. Copy the full SHA
    e076a08 View commit details
  4. Copy the full SHA
    b0ab712 View commit details
  5. Copy the full SHA
    dd3509a View commit details

Commits on Apr 4, 2025

  1. handle default issue with multiple inheritance (#687)

    * handle default issue with multiple inheritance
    sethbuff authored Apr 4, 2025
    Copy the full SHA
    4a4bcd6 View commit details
  2. revving to 0.3.5

    slorello89 committed Apr 4, 2025
    Copy the full SHA
    8e39ee0 View commit details

Commits on Apr 9, 2025

  1. fix: cast from db connections with non decoded output (#664)

    cast from db connections with non decoded output
    fixes #2418
    ivanbelenky authored Apr 9, 2025
    Copy the full SHA
    233615b View commit details

Commits on Apr 10, 2025

  1. FIELDENG-593 Adding EntraID explainer to README (#688)

    * Adding EntraID explainer to README
    
    ---------
    
    Co-authored-by: Andrew Brookins <andrew.brookins@redis.com>
    Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
    3 people authored Apr 10, 2025
    Copy the full SHA
    277ed25 View commit details

Commits on Apr 30, 2025

  1. Full Pydantic 2.0 Support + Bug Fixes (#691)

    * remove pydantic v1 references
    
    * set validate_default=True
    
    * Remove unused imports
    
    * update models to specify when a model is final
    
    * fix knn setup
    
    * Update KNN test query
    
    * Update KNN results include score
    
    * remove use of alias for queries
    
    * fix lint issues
    
    * fix lint issues
    
    * fix annotations for python < 3.10
    
    * fix annotations for python < 3.10
    
    * fix issue where certain fields were unintentionally being indexed
    
    * remove vscode settings
    
    * dynamically set index based on other fields that require indexes
    
    * fix inheritance from indexed model
    
    * fix linting errors
    
    * change version to beta
    
    * make default a positional arg on Field
    
    * Include knn in model construction
    
    * add warning for auto indexing
    
    * use field info args without default to prevent overlapping values
    
    * update typing to support older python versions
    
    ---------
    
    Co-authored-by: jmmenard <89422205+jmmenard@users.noreply.github.com>
    sethbuff and jmmenard authored Apr 30, 2025
    Copy the full SHA
    cd117b2 View commit details

Commits on May 9, 2025

  1. fix typing for python 3.8, fix warning (#698)

    * fix typing for python 3.8, fix warning
    
    * bump version
    sethbuff authored May 9, 2025
    Copy the full SHA
    7ca997c View commit details

Commits on May 13, 2025

  1. fix issue with nested vector fields and python 3.13 issubclass changes (

    #699)
    
    * fix issue with nested vector fields and python 3.13 issubclass changes
    
    * update version
    
    * update numeric checks to be utility functions
    
    * remove vscode settings
    
    * fix flaky test
    
    * fix flaky test
    sethbuff authored May 13, 2025
    Copy the full SHA
    8ddb6b7 View commit details
4 changes: 4 additions & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
@@ -56,3 +56,7 @@ validator
validators
virtualenv
http
AMR
EntraID
entraid
metamodel
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
pyver: [ "3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.9", "pypy-3.10" ]
pyver: [ "3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "pypy-3.10" ]
redisstack: [ "latest" ]
fail-fast: false
services:
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ jobs:
- name: Set Poetry config
run: |
pip install --upgrade pip poetry
pip install --upgrade pip poetry==1.8.4
poetry config virtualenvs.in-project false
poetry config virtualenvs.path ~/.virtualenvs
poetry export --dev --without-hashes -o requirements.txt
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Check Spelling
uses: rojopolis/spellcheck-github-actions@0.36.0
uses: rojopolis/spellcheck-github-actions@0.44.0
with:
config_path: .github/spellcheck-settings.yml
task_name: Markdown
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -143,4 +143,7 @@ tests_sync/
# spelling cruft
*.dic

.idea
.idea

# version files
.tool-versions
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ sync: $(INSTALL_STAMP)
lint: $(INSTALL_STAMP) dist
$(POETRY) run isort --profile=black --lines-after-imports=2 ./tests/ $(NAME) $(SYNC_NAME)
$(POETRY) run black ./tests/ $(NAME)
$(POETRY) run flake8 --ignore=W503,E501,F401,E731,E712 ./tests/ $(NAME) $(SYNC_NAME)
$(POETRY) run flake8 --ignore=E231,E501,E712,E731,F401,W503 ./tests/ $(NAME) $(SYNC_NAME)
$(POETRY) run mypy ./tests/ $(NAME) $(SYNC_NAME) --ignore-missing-imports --exclude migrate.py --exclude _compat\.py$
$(POETRY) run bandit -r $(NAME) $(SYNC_NAME) -s B608

32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<br/>
<br/>
<img width="360" src="https://raw.githubusercontent.com/redis-developer/redis-om-python/main/images/logo.svg?token=AAAXXHUYL6RHPESRRAMBJOLBSVQXE" alt="Redis OM" />
<img width="360" src="docs/images/logo.svg" alt="Redis OM" />
<br/>
<br/>
</div>
@@ -370,6 +370,36 @@ You can run these modules in your self-hosted Redis deployment, or you can use [

To learn more, read [our documentation](docs/redis_modules.md).

## Connecting to Azure Managed Redis with EntraID

Once you have EntraID setup for your Azure Managed Redis (AMR) deployment, you can use Redis OM Python with it by leveraging the [redis-py-entraid](https://github.com/redis/redis-py-entraid) library.
Simply install the library with:

```
pip install redis-entraid
```

Then you'll initialize your credentials provider, connect to redis, and pass the database object into your metamodel:

```python

from redis import Redis
from redis_entraid.cred_provider import create_from_default_azure_credential
from redis_om import HashModel, Field
credential_provider = create_from_default_azure_credential(
("https://redis.azure.com/.default",),
)

db = Redis(host="cluster-name.region.redis.azure.net", port=10000, ssl=True, ssl_cert_reqs=None, credential_provider=credential_provider)
db.flushdb()
class User(HashModel):
first_name: str
last_name: str = Field(index=True)

class Meta:
database = db
```

## ❤️ Contributing

We'd love your contributions!
99 changes: 0 additions & 99 deletions aredis_om/_compat.py

This file was deleted.

1 change: 0 additions & 1 deletion aredis_om/checks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from functools import lru_cache
from typing import List

from aredis_om.connections import get_redis_connection

9 changes: 6 additions & 3 deletions aredis_om/model/encoders.py
Original file line number Diff line number Diff line change
@@ -31,7 +31,9 @@
from types import GeneratorType
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union

from .._compat import ENCODERS_BY_TYPE, BaseModel
from pydantic import BaseModel
from pydantic.deprecated.json import ENCODERS_BY_TYPE
from pydantic_core import PydanticUndefined


SetIntStr = Set[Union[int, str]]
@@ -72,7 +74,7 @@ def jsonable_encoder(
encoder = getattr(obj.__config__, "json_encoders", {})
if custom_encoder:
encoder.update(custom_encoder)
obj_dict = obj.dict(
obj_dict = obj.model_dump(
include=include, # type: ignore # in Pydantic
exclude=exclude, # type: ignore # in Pydantic
by_alias=by_alias,
@@ -90,7 +92,7 @@ def jsonable_encoder(
sqlalchemy_safe=sqlalchemy_safe,
)
if dataclasses.is_dataclass(obj):
return dataclasses.asdict(obj)
return dataclasses.asdict(obj) # type: ignore
if isinstance(obj, Enum):
return obj.value
if isinstance(obj, PurePath):
@@ -106,6 +108,7 @@ def jsonable_encoder(
or (not isinstance(key, str))
or (not key.startswith("_sa"))
)
and value is not PydanticUndefined
and (value is not None or not exclude_none)
and ((include and key in include) or not exclude or key not in exclude)
):
3 changes: 3 additions & 0 deletions aredis_om/model/migrations/migrator.py
Original file line number Diff line number Diff line change
@@ -130,6 +130,9 @@ async def detect_migrations(self):
continue

stored_hash = await conn.get(hash_key)
if isinstance(stored_hash, bytes):
stored_hash = stored_hash.decode("utf-8")

schema_out_of_date = current_hash != stored_hash

if schema_out_of_date:
Loading