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