pydoptic-elastic 0.0.2.post1.dev1__tar.gz → 0.0.2.post1.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pydoptic_elastic-0.0.2.post1.dev1/src/pydoptic_elastic.egg-info → pydoptic_elastic-0.0.2.post1.dev2}/PKG-INFO +2 -2
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/README.md +1 -1
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic/elastic_service.py +3 -3
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2/src/pydoptic_elastic.egg-info}/PKG-INFO +2 -2
- pydoptic_elastic-0.0.2.post1.dev2/src/pydoptic_elastic.egg-info/scm_version.json +8 -0
- pydoptic_elastic-0.0.2.post1.dev1/src/pydoptic_elastic.egg-info/scm_version.json +0 -8
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/LICENSE +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/pyproject.toml +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/setup.cfg +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic/__init__.py +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic/elastic_model.py +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic/elastic_query.py +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic/py.typed +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic.egg-info/SOURCES.txt +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic.egg-info/dependency_links.txt +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic.egg-info/requires.txt +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic.egg-info/scm_file_list.json +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/src/pydoptic_elastic.egg-info/top_level.txt +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/test/test_elastic_model.py +0 -0
- {pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/test/test_elastic_service.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydoptic-elastic
|
|
3
|
-
Version: 0.0.2.post1.
|
|
3
|
+
Version: 0.0.2.post1.dev2
|
|
4
4
|
Summary: An Elasticsearch integration built on pydoptic
|
|
5
5
|
Author: John Hungerford
|
|
6
6
|
License-Expression: MIT
|
|
@@ -53,7 +53,7 @@ for person in service.search(query):
|
|
|
53
53
|
print(Person.name.get_val(person))
|
|
54
54
|
# John
|
|
55
55
|
|
|
56
|
-
# Retrieve only specific fields, as a
|
|
56
|
+
# Retrieve only specific fields, as a Partial:
|
|
57
57
|
for person in service.search_partial(query, source=[Person.name]):
|
|
58
58
|
print(Person.name.get_val_unsafe(person))
|
|
59
59
|
# John
|
|
@@ -35,7 +35,7 @@ for person in service.search(query):
|
|
|
35
35
|
print(Person.name.get_val(person))
|
|
36
36
|
# John
|
|
37
37
|
|
|
38
|
-
# Retrieve only specific fields, as a
|
|
38
|
+
# Retrieve only specific fields, as a Partial:
|
|
39
39
|
for person in service.search_partial(query, source=[Person.name]):
|
|
40
40
|
print(Person.name.get_val_unsafe(person))
|
|
41
41
|
# John
|
|
@@ -2,7 +2,7 @@ from typing import List, Iterable, Any, Dict, Type
|
|
|
2
2
|
|
|
3
3
|
from elasticsearch import Elasticsearch, NotFoundError
|
|
4
4
|
|
|
5
|
-
from pydoptic import BaseModel, Select,
|
|
5
|
+
from pydoptic import BaseModel, Select, Partial
|
|
6
6
|
from pydoptic.selector import Prop
|
|
7
7
|
from pydoptic_elastic.elastic_model import M
|
|
8
8
|
from pydoptic_elastic.elastic_query import Query
|
|
@@ -39,7 +39,7 @@ class ElasticService:
|
|
|
39
39
|
except NotFoundError:
|
|
40
40
|
return None
|
|
41
41
|
|
|
42
|
-
def get_partial(self, cls: Type[M], id: str, **kwargs) ->
|
|
42
|
+
def get_partial(self, cls: Type[M], id: str, **kwargs) -> Partial[M] | None:
|
|
43
43
|
try:
|
|
44
44
|
response = self.__client.get(index = cls._get_index_name(), id=id, **kwargs)
|
|
45
45
|
return _GetResponse.doc.get_unsafe(response.body).map(lambda d: cls.partial(**d)).as_opt
|
|
@@ -59,7 +59,7 @@ class ElasticService:
|
|
|
59
59
|
_source = hit['_source']
|
|
60
60
|
yield query.model(**_source)
|
|
61
61
|
|
|
62
|
-
def search_partial(self, query: Query[M], source: Iterable[Select[M, Any]] | None = None, **kwargs) -> Iterable[
|
|
62
|
+
def search_partial(self, query: Query[M], source: Iterable[Select[M, Any]] | None = None, **kwargs) -> Iterable[Partial[M]]:
|
|
63
63
|
_kwargs = kwargs if source is None else {'source': [sel.path for sel in source], **kwargs}
|
|
64
64
|
search_results = self.__client.search(index=query.model._get_index_name(), query=query.to_dict(), **_kwargs)
|
|
65
65
|
for hit in search_results['hits']['hits']:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydoptic-elastic
|
|
3
|
-
Version: 0.0.2.post1.
|
|
3
|
+
Version: 0.0.2.post1.dev2
|
|
4
4
|
Summary: An Elasticsearch integration built on pydoptic
|
|
5
5
|
Author: John Hungerford
|
|
6
6
|
License-Expression: MIT
|
|
@@ -53,7 +53,7 @@ for person in service.search(query):
|
|
|
53
53
|
print(Person.name.get_val(person))
|
|
54
54
|
# John
|
|
55
55
|
|
|
56
|
-
# Retrieve only specific fields, as a
|
|
56
|
+
# Retrieve only specific fields, as a Partial:
|
|
57
57
|
for person in service.search_partial(query, source=[Person.name]):
|
|
58
58
|
print(Person.name.get_val_unsafe(person))
|
|
59
59
|
# John
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/test/test_elastic_model.py
RENAMED
|
File without changes
|
{pydoptic_elastic-0.0.2.post1.dev1 → pydoptic_elastic-0.0.2.post1.dev2}/test/test_elastic_service.py
RENAMED
|
File without changes
|