Skip to content

Commit 76330f5

Browse files
bartonipIvanShirokikh
authored andcommitted
Implemented Django style filtering
Closes SAP#113 Signed-off-by: Jakub Filak <[email protected]>
1 parent 92410a1 commit 76330f5

File tree

6 files changed

+709
-38
lines changed

6 files changed

+709
-38
lines changed

CHANGELOG.md

+26
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
### Added
10+
- Specify PATCH, PUT, or MERGE method for EntityUpdateRequest - Barton Ip
11+
- Add a Service wide configuration (e.g. http.update\_method) - Jakub Filak
12+
- <, <=, >, >= operators on GetEntitySetFilter - Barton Ip
13+
- Django style filtering - Barton Ip
14+
15+
### Fixed
16+
- URL encode $filter contents - Barton Ip
17+
18+
## [1.5.0]
19+
20+
### Added
21+
- support for Edm.Float - Jakub Filak
22+
23+
### Changed
24+
- handle GET EntitySet payload without the member results - Jakub Filak
25+
- both Literal and JSON DateTimes has Timezone set to UTC - Jakub Filak
26+
27+
### Fixed
28+
- removed superfluous debug print when parsing FunctionImports from metadata - Jakub Filak
29+
- property 'Nullable' attributes are correctly parsed and respected - Vasilii Khomutov
30+
- use correct type of deserialization of Literal (URL) structure values - Jakub Filak
31+
- null values are correctly handled - Jakub Filak
32+
33+
## [1.4.0]
34+
935
### Added
1036
- Client can be created from local metadata - Jakub Filak
1137
- support all standard EDM schema versions - Jakub Filak

docs/usage/querying.rst

+30
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,36 @@ Print unique identification (Id) of all employees with name John Smith:
6666
print(smith.EmployeeID)
6767
6868
69+
Get entities matching a filter in ORM style
70+
---------------------------------------------------
71+
72+
Print unique identification (Id) of all employees with name John Smith:
73+
74+
.. code-block:: python
75+
76+
from pyodata.v2.service import GetEntitySetFilter as esf
77+
78+
smith_employees_request = northwind.entity_sets.Employees.get_entities()
79+
smith_employees_request = smith_employees_request.filter(FirstName="John", LastName="Smith")
80+
for smith in smith_employees_request.execute():
81+
print(smith.EmployeeID)
82+
83+
84+
Get entities matching a complex filter in ORM style
85+
---------------------------------------------------
86+
87+
Print unique identification (Id) of all employees with name John Smith:
88+
89+
.. code-block:: python
90+
91+
from pyodata.v2.service import GetEntitySetFilter as esf
92+
93+
smith_employees_request = northwind.entity_sets.Employees.get_entities()
94+
smith_employees_request = smith_employees_request.filter(FirstName__contains="oh", LastName__startswith="Smi")
95+
for smith in smith_employees_request.execute():
96+
print(smith.EmployeeID)
97+
98+
6999
Get a count of entities
70100
-----------------------
71101

pyodata/v2/model.py

+3
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,9 @@ def proprty(self, property_name):
14791479
def proprties(self):
14801480
return list(self._properties.values())
14811481

1482+
def has_proprty(self, proprty_name):
1483+
return proprty_name in self._properties
1484+
14821485
@classmethod
14831486
def from_etree(cls, type_node, config: Config):
14841487
name = type_node.get("Name")

0 commit comments

Comments
 (0)