Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1103 Improve arrow function #1112

Merged
merged 29 commits into from
Oct 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
63f269f
improve arrow function
dantownsend Oct 18, 2024
a58663b
fix tests
dantownsend Oct 19, 2024
976f3ef
refactor, so we have an `Arrow` function
dantownsend Oct 20, 2024
fe2ce3d
add test for nested arrow functions
dantownsend Oct 20, 2024
64a208e
skip sqlite
dantownsend Oct 20, 2024
91c3f84
allow `arrow` to access keys multiple levels deep
dantownsend Oct 20, 2024
326a15d
improve the example data in the playground for JSON data
dantownsend Oct 20, 2024
7493d3e
move arrow function to JSON, as it can be used by JSON or JSONB
dantownsend Oct 23, 2024
b22073f
add `arrow` function to Arrow, so it can be called recursively
dantownsend Oct 23, 2024
b51d07e
change heading levels of JSON docs
dantownsend Oct 23, 2024
d89900b
move `Arrow` to operators folder
dantownsend Oct 23, 2024
f1e3199
update docs
dantownsend Oct 23, 2024
71f279a
improve docstring
dantownsend Oct 23, 2024
e2bce7f
add `technicians` to example JSON
dantownsend Oct 23, 2024
27f6711
improve docstrings
dantownsend Oct 23, 2024
203190d
allow `QueryString` as an arg type to `Arrow`
dantownsend Oct 23, 2024
c1622ca
fix docstring error
dantownsend Oct 23, 2024
7ee664d
make sure integers can be passed in
dantownsend Oct 23, 2024
b46ab42
add `QueryString` as an arg type to `arrow` method
dantownsend Oct 23, 2024
fb3e13c
added `GetElementFromPath`
dantownsend Oct 23, 2024
056a4c9
add docs for ``from_path``
dantownsend Oct 23, 2024
0bc8ffe
add `__getitem__` as a shortcut for the arrow method
dantownsend Oct 23, 2024
ec6b6af
update the docs to use the square bracket notation
dantownsend Oct 23, 2024
cedb3fe
explain why the method is called `arrow`
dantownsend Oct 23, 2024
2867fde
move arrow tests into separate class
dantownsend Oct 23, 2024
4769caf
add `test_multiple_levels_deep`
dantownsend Oct 23, 2024
55dee3d
add tests for `for_path`
dantownsend Oct 23, 2024
0b760e2
last documentation tweaks
dantownsend Oct 23, 2024
87f8411
add basic operator tests
dantownsend Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make sure integers can be passed in
  • Loading branch information
dantownsend committed Oct 23, 2024
commit 7ee664dddcb9367b9f0443fc0e5053c2375bc905
5 changes: 5 additions & 0 deletions piccolo/query/operators/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def __init__(
key: t.Union[str, int, QueryString],
alias: t.Optional[str] = None,
):
if isinstance(key, int):
# asyncpg only accepts integer keys if we explicitly mark it as an
# int.
key = QueryString("{}::int", key)

super().__init__("{} -> {}", identifier, key, alias=alias)

def clean_value(self, value: t.Any):
Expand Down