dotted-notation 0.55.4__tar.gz → 0.56.0__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.
Files changed (54) hide show
  1. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/CHANGELOG.md +201 -0
  2. {dotted_notation-0.55.4/dotted_notation.egg-info → dotted_notation-0.56.0}/PKG-INFO +450 -158
  3. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/README.md +449 -157
  4. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/access.py +46 -1
  5. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/api.py +22 -12
  6. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/base.py +38 -8
  7. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/engine.py +3 -31
  8. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/filters.py +21 -0
  9. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/grammar.py +56 -16
  10. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/groups.pxd +2 -1
  11. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/groups.py +201 -158
  12. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/matchers.py +48 -0
  13. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/recursive.py +29 -7
  14. dotted_notation-0.56.0/dotted/translators/core.py +1797 -0
  15. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/translators/spark.py +91 -25
  16. dotted_notation-0.56.0/dotted/translators/spark_pyspark.py +2736 -0
  17. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/translators/sql.py +46 -11
  18. dotted_notation-0.56.0/dotted/translators/sql_pg.py +1865 -0
  19. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/utypes.py +1 -3
  20. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/wrappers.py +26 -8
  21. {dotted_notation-0.55.4 → dotted_notation-0.56.0/dotted_notation.egg-info}/PKG-INFO +450 -158
  22. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/pyproject.toml +1 -1
  23. dotted_notation-0.55.4/dotted/translators/core.py +0 -613
  24. dotted_notation-0.55.4/dotted/translators/spark_pyspark.py +0 -548
  25. dotted_notation-0.55.4/dotted/translators/sql_pg.py +0 -880
  26. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/LICENSE +0 -0
  27. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/MANIFEST.in +0 -0
  28. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/__init__.py +0 -0
  29. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/__main__.py +0 -0
  30. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/access.pxd +0 -0
  31. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/base.pxd +0 -0
  32. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/cli/__init__.py +0 -0
  33. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/cli/_compat.py +0 -0
  34. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/cli/formats.py +0 -0
  35. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/cli/main.py +0 -0
  36. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/containers.py +0 -0
  37. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/engine.pxd +0 -0
  38. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/filters.pxd +0 -0
  39. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/matchers.pxd +0 -0
  40. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/native.py +0 -0
  41. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/predicates.py +0 -0
  42. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/recursive.pxd +0 -0
  43. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/results.py +0 -0
  44. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/transforms.py +0 -0
  45. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/translators/__init__.py +0 -0
  46. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/utils.py +0 -0
  47. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted/wrappers.pxd +0 -0
  48. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted_notation.egg-info/SOURCES.txt +0 -0
  49. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted_notation.egg-info/dependency_links.txt +0 -0
  50. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted_notation.egg-info/entry_points.txt +0 -0
  51. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted_notation.egg-info/requires.txt +0 -0
  52. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/dotted_notation.egg-info/top_level.txt +0 -0
  53. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/setup.cfg +0 -0
  54. {dotted_notation-0.55.4 → dotted_notation-0.56.0}/setup.py +0 -0
@@ -3,6 +3,207 @@
3
3
  All notable changes to `dotted` are recorded here. Versions prior to
4
4
  the ones listed are omitted — browse git history for earlier entries.
5
5
 
6
+ ## [0.56.0]
7
+
8
+ ### Added
9
+ - `sqlize` and `sparkize` translate `,` and `&` groups anywhere in a
10
+ path, and a path that goes on after a group:
11
+ `event.(data, data.components[*]).(amount, reporting_amount)`. A
12
+ group matches as `get` does: each branch's matches, the path after
13
+ the group run on from each; an `&` group only where every branch
14
+ matches, at each node it is at, so `users[*].(age >= 30 & active =
15
+ True)` needs one user who is both. `sqlize` reads each branch's
16
+ matches in turn (`UNION ALL` in `r.lateral`); `sparkize` joins the
17
+ branches' matches with `concat`.
18
+ - `sqlize` and `sparkize` translate first-match groups, `(a, b)?`: the
19
+ first match of the first branch to have one, the branch alone, the
20
+ path after it run on from that match, at each node the group is at.
21
+ A guard after the group tests that match: `data.(users[*], user)?.age
22
+ >= 30` is the first user's age, or `user`'s where there are none.
23
+ Both take the first in dotted's order at each node.
24
+ - `sqlize` and `sparkize` translate a cut, `#`, at each node the group
25
+ is at: after `(a#, b)`'s `a` reaches something, `b` isn't tried
26
+ there. `sqlize` reads `b` only at the nodes where `a` reaches
27
+ nothing; `sparkize` adds `b`'s matches only where `a` found none.
28
+ A cut in a conjunction leaves the branches after it unneeded.
29
+ - `sqlize` and `sparkize` translate a soft cut, `##`: in `(a##, *)`,
30
+ `*` skips what overlaps `a`'s matches, at each node, folded in order
31
+ as dotted does, so `((a.b, a, a.d)##, *)` keeps `a.d`, the `a` it
32
+ overlaps having been dropped. `sqlize` folds the branches' matches,
33
+ read with their paths, with a recursive query; `sparkize` reads them
34
+ as (path, value) structs and folds them with `aggregate`. An aligned
35
+ op under a soft cut raises.
36
+ - `sqlize` and `sparkize` read a group at the top of a path,
37
+ `(title, author)`, or after a table search's row step,
38
+ `books[*](.title, .author)`, over the row's columns as one value: a
39
+ `jsonb_build_object` of the columns its branches name in `sqlize`, a
40
+ struct of them in `sparkize`. Every kind of group, cut and soft cut
41
+ matches there as at any node, and `select` is its matches; a group
42
+ of guards keeps its plain `where`. Such a group had a `where` only,
43
+ raised where a branch had no predicate, and raised with a path after
44
+ a first-match group.
45
+ - Under `root='table'`, `sqlize` reads a negation over the row's
46
+ columns, `books[*](!.title)`, as the complement among all of them,
47
+ from the table's whole row, `to_jsonb(books)`. It raises in a column
48
+ path and in a search of an unnamed table, which have no row to read
49
+ whole. `sparkize` reads it from the struct of all the columns the
50
+ schema has.
51
+ - A group as a table search's row step, `books[(*&a=1, *&b=2)]` or
52
+ `books([*&a=1], [*&b=2])`, in `sqlize` and `sparkize`: each branch's
53
+ rows in turn, a row both reach twice, as dotted yields them, the path
54
+ after the group run on from each. The group reads the table as one
55
+ node: a cut holds over the table, a soft cut skips the rows an
56
+ earlier branch yielded, a first match is the first branch's first
57
+ row, an `&` yields only where every branch reaches a row, and
58
+ `books(![*&a=1])` is the rows `[*&a=1]` doesn't reach. `sqlize`
59
+ gives the rows as a derived table in `r.from_`; `sparkize` reads them
60
+ from the table's DataFrame with `r.rows(df)`. Raises for an unnamed
61
+ table in `sqlize`, a branch past its row step, and a soft cut or
62
+ negation over rows an index picks.
63
+ - `r.from_` is set on every `sqlize` table search: the table, quoted
64
+ where it needs it, or a group of row steps' rows. Select from it
65
+ rather than `r.table`. `sparkize`'s `r.rows(df)` is `df` for a
66
+ search without such a group.
67
+ - `sparkize` reads `**`, `**+`, `.*` and `[*]` over a struct's fields,
68
+ and slices, `[1:3]`, `[::-1]`, which need the schema `build` now
69
+ takes. A `**` with depths or accessors still raises.
70
+ - `sqlize`'s `r.as_update(value)`: the write of `value` at a column
71
+ path's matches, as `update` does it, for an `UPDATE ... SET`:
72
+ `'UPDATE items SET ' + r.as_update('admin')`. `value` goes at each
73
+ match; along literal keys and slots the nodes the path lacks are
74
+ built, a null one replaced, as `update` builds them, and a slot past
75
+ the end appends; a pattern, filter or guard writes only what is
76
+ there and passes; `~` holds a segment back; `[+]` appends, and
77
+ `[+?]` where the array doesn't hold the value, as Python's `in`
78
+ tells. A value is a literal, sent as a parameter, or a `Raw` / `Col`
79
+ expression; a transform at the end of the path applies to a literal.
80
+ Where `update` raises, the query fails with a `dotted update: …`
81
+ message. Groups, `!`, `**` and slices in a write raise, as does a
82
+ table search's write; `sparkize` has no `as_update` yet.
83
+ - Cuts in a conjunction, by `get`, `update` and `remove` alike, at
84
+ each node: in `(a#&b)`, once `a` matches, `b` isn't tried; in
85
+ `(a##&*)`, `*` skips what overlaps `a`'s matches, a branch the soft
86
+ cut covers whole adding nothing but still matching.
87
+
88
+ ### Changed
89
+ - `sparkize` reads as dotted reads, each node by its Spark type, a
90
+ struct and a map as a dict and an array as a list, as
91
+ `row.asDict(recursive=True)` hands them to Python; it read every node
92
+ as Spark's own extraction and comparisons do. `build` takes the
93
+ DataFrame's schema, which says what each node is, and raises without
94
+ it: `r.build(r.where, schema=df.schema)`.
95
+ - a key reads a struct's field or a map's value, `.0` an array's
96
+ element, a string's character or a map's value at the int key 0;
97
+ a key on an array of structs no longer reads every element's
98
+ field. A struct's null field is there, a None, and a map's missing
99
+ key isn't: `= None` matches the one, not the other.
100
+ - a comparison goes as Python's does, by the values' types, exactly:
101
+ `True == 1`, an int never equal to `0.1`, a `DECIMAL` `0.1` not the
102
+ float `0.1`, a string and a number unequal and unordered where
103
+ Spark cast, a NaN ordered nowhere; `!=` holds for a null, and
104
+ `< None` is false where it raised.
105
+ - a regex fullmatches `str()` of the value, written in Java's syntax
106
+ as Python reads it; `rlike` searched, so `/^act/` no longer finds
107
+ `'active'`. `|int`, `|float` and `|str` run as dotted's, where they
108
+ were casts; `|bool` and the rest raise.
109
+ - `[*]` reads a map's values, a struct's fields and a string's
110
+ characters; `.*` a struct's fields; a slice filter,
111
+ `users[active = False]`, the filtered list as one value; `*?` its
112
+ first match, None included.
113
+ - a `Column` binding compares by its type, read in the active
114
+ session; a Python one as Python compares it.
115
+ - a path with no pattern in it, `data.a|int`, selects its one value,
116
+ not an array.
117
+ - where dotted raises, or its answer is a Python repr, the job fails
118
+ with a `dotted: …` message. A `select` whose matches can be of
119
+ more than one type raises at `build`: a Spark array holds one.
120
+ - `sqlize` reads a JSONB column a step at a time, as dotted's walk
121
+ does, and compares as dotted compares; it read it with JSONPath,
122
+ whose lax mode and casts gave other answers:
123
+ - a guard compares by the value's type: a number with a number or a
124
+ boolean (`True == 1`), a string with a string in code-point order,
125
+ any other pairing unequal and unordered, so `'30' >= 30` is false
126
+ where a cast raised; `!=` is `=`'s negation, and `< None` is false;
127
+ - a guard tests a value that's there: a missing key is neither
128
+ `= None` nor `!= 1`;
129
+ - a regex fullmatches `str()` of the value, so `/^a/` no longer
130
+ finds `'active'`; on a SQL column too, `~ '^(?:…)$'`, where `!=`
131
+ now holds for a NULL, `IS DISTINCT FROM`;
132
+ - a key reads an object's member, an int an array's element or a
133
+ string's character, never a member; `[*]` reads an object's values
134
+ and a string's characters too; `*?` reads its first match alone;
135
+ - a slice filter, `users[age >= 30]`, reads the filtered list as one
136
+ value, there even when empty;
137
+ - a filter keeps a node that is an object whose key compares, so
138
+ `[*&x!=1]` keeps one with no `x`; a `!` filter holds for a NULL;
139
+ - a guard's `int`, `float` and `str` transforms run as dotted's;
140
+ other transforms, and any with arguments, raise where they were
141
+ ignored;
142
+ - a substitution compared inside JSONB is sent as its JSON text,
143
+ cast to `jsonb`, and compares by its bound type; a list or dict
144
+ bound there raises in `build`, as dotted raises;
145
+ - where dotted's answer is a Python repr, `str()` of an array or
146
+ object, the query fails with a `dotted: …` message;
147
+ - `r.where` is an `EXISTS` over the walk and `r.lateral` its
148
+ matches, with no `jsonb_path_*` call; numbers and booleans are
149
+ inline, and no parameter is cast. A `**` with depths or accessors,
150
+ `**:2`, raises.
151
+ - A one-branch group's cut is on the group it's in, as parentheses
152
+ alone don't make a group: `((a#)&b)` is `(a#&b)`, and `((a#), b)` is
153
+ `(a#, b)`, which gave `(1, 2)` on `{a: 1, b: 2}` and gives `(1,)`. A
154
+ trailing comma, `(a#,)`, keeps the group and its cut.
155
+
156
+ ### Fixed
157
+ - `update` with a key on a str, list or tuple, `a.b`, raises
158
+ `TypeError: Cannot update str by key 'b'`, as on an int; it built
159
+ `'<itertools.chain object …>'` or a list of pairs. A slot past the
160
+ end of a str appends, `'xyz'` to `'xyzV'`, where it appended a
161
+ generator's repr. A key wildcard on a list, `a.*`, writes nothing, as
162
+ a read there matches nothing, where it raised `IndexError`. The rest
163
+ of the fallbacks for immutable nodes is #72.
164
+ - A first-match group's cut assembles: `(a#, b)?` assembled as
165
+ `(a,b)?`, which parses without the cut.
166
+ - A cut, `#`, ends only its group's later branches, at each node the
167
+ group is at, as `update` and `remove` already read it (#71). `get`,
168
+ `pluck` and the other walks ended the whole walk at the first cut,
169
+ so `x[*].(a#, b)` over `[{a: 1}, {a: 2, b: 9}, {b: 3}]` was `(1,)`;
170
+ it is `(1, 2, 3)`, each element's `a`, or its `b` where it has none.
171
+ - A group of guards, `data.(a = 1, b = 2)`, selects its matches, as
172
+ `get` gives them, not the node the group is at. Its `where` is
173
+ unchanged.
174
+ - `!` groups translated to SQL `NOT` and Spark `~`, which is not what
175
+ they mean: `!` is the complement of what its path matches, so
176
+ `data.(!(status = "banned"))` matches `x` in `{"status": "banned",
177
+ "x": 1}`. `sqlize` and `sparkize` now yield that complement, the
178
+ largest subtrees that hold no match, as dotted does: `sqlize` with a
179
+ recursive query over the children the matches run through, and
180
+ `sparkize` level by level to the depth the negated path reads, over
181
+ a struct's fields, a map's entries and an array's elements. A
182
+ negation reaching any depth raises in `sparkize`.
183
+ - `sqlize` reads a bare wildcard filter key, `[*=1]`, as any member;
184
+ it read a key named `*`.
185
+ - `sqlize` and `sparkize` raise `TranslationError` on inputs they
186
+ translated to something else: an append (`[+]`) or a concatenation
187
+ as a path segment, a wildcard guard value (`a=*` compared `a` with
188
+ the string `"*"`), and an unresolved substitution in a filter key
189
+ (`[$(k)=1]` read the key `k`).
190
+
191
+ ### Changed
192
+ - Ops, matchers and filters reach the translators through hooks: each
193
+ class names its own with `translated(translation, *args)`, and a
194
+ translation reads each kind it supports in a `translators.core.Hooks`
195
+ subclass, a kind it doesn't raising in that subclass's `other`.
196
+
197
+ ## [0.55.5]
198
+
199
+ ### Fixed
200
+ - `match` and `match_multi` honor `strict=True`, which they took and
201
+ ignored: a key pattern matches only a key, a slot pattern only a
202
+ slot, an attr pattern only an attr, as strict mode does for `get`.
203
+ `match('[*]', 'table', strict=True)` and `match('*', '[0]',
204
+ strict=True)` are `None`. `**` reads keys, so under strict it
205
+ consumes only key segments; `*(.*,[*])` reads both.
206
+
6
207
  ## [0.55.4]
7
208
 
8
209
  ### Changed