sqlload-api 0.85.0__py3-none-any.whl
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.
- sqlload_api/__init__.py +68 -0
- sqlload_api/_data.py +213 -0
- sqlload_api/_http.py +428 -0
- sqlload_api/_http_paths.py +218 -0
- sqlload_api/_registry.py +103 -0
- sqlload_api/_transform.py +113 -0
- sqlload_api/_wire/__init__.py +149 -0
- sqlload_api/_wire/checkpoint.json +6 -0
- sqlload_api/_wire/fan_out_batch.json +53 -0
- sqlload_api/_wire/fan_out_nested.json +85 -0
- sqlload_api/_wire/fan_out_values.json +28 -0
- sqlload_api/_wire/json_document.json +17 -0
- sqlload_api/_wire/ndjson_lines.json +17 -0
- sqlload_api/_wire/paginate_cells.json +34 -0
- sqlload_api/_wire/paginate_cursor.json +23 -0
- sqlload_api/_wire/paginate_header_row.json +29 -0
- sqlload_api/_wire/paginate_link_header.json +24 -0
- sqlload_api/_wire/paginate_next_link.json +21 -0
- sqlload_api/_wire/paginate_offset.json +27 -0
- sqlload_api/_wire/paginate_page_number_post.json +30 -0
- sqlload_api/_wire/paginate_projected.json +53 -0
- sqlload_api/py.typed +0 -0
- sqlload_api-0.85.0.dist-info/METADATA +34 -0
- sqlload_api-0.85.0.dist-info/RECORD +26 -0
- sqlload_api-0.85.0.dist-info/WHEEL +4 -0
- sqlload_api-0.85.0.dist-info/licenses/LICENSE +201 -0
sqlload_api/_registry.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Functions a project picks by name: each decorator (`@sl.transform`) registers functions in a registry of its own.
|
|
2
|
+
|
|
3
|
+
A function registers under its own name, or the one the decorator is given; `sqlload.toml` names it. Discovery imports
|
|
4
|
+
every module under `python_paths`, which runs the decorators, so `plan` can look a name up and refuse one that is
|
|
5
|
+
unknown or registered twice.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import inspect
|
|
9
|
+
from collections.abc import Callable
|
|
10
|
+
from dataclasses import dataclass
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class Registered:
|
|
17
|
+
"""A function registered under a name, and the file it is defined in."""
|
|
18
|
+
|
|
19
|
+
function: Callable[..., Any]
|
|
20
|
+
file: str
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Registry:
|
|
24
|
+
"""The functions one decorator registered, by name."""
|
|
25
|
+
|
|
26
|
+
def __init__(self, decorator: str) -> None:
|
|
27
|
+
self.decorator = decorator
|
|
28
|
+
self._named: dict[str, list[Registered]] = {}
|
|
29
|
+
#: Functions passed as themselves (`transform=page`) rather than by a registered name, by the key they go by, with
|
|
30
|
+
#: the name they are shown by. Held until the run finishes (`release`): a job keeps only the key, so an inline lambda
|
|
31
|
+
#: would otherwise be gone before its pages are called.
|
|
32
|
+
self._passed: dict[str, tuple[Callable[..., Any], str]] = {}
|
|
33
|
+
|
|
34
|
+
def register(self, name: str, function: Callable[..., Any]) -> None:
|
|
35
|
+
"""Register `function` under `name`; the same function registered again (its module imported again) replaces itself."""
|
|
36
|
+
if not callable(function):
|
|
37
|
+
raise TypeError(f"{self.decorator} decorates a function, not {type(function).__name__}")
|
|
38
|
+
if not name:
|
|
39
|
+
raise ValueError(f"{self.decorator} needs a name that is not empty")
|
|
40
|
+
file = _file(function)
|
|
41
|
+
kept = [entry for entry in self._named.get(name, []) if (entry.file, entry.function.__qualname__) != (file, function.__qualname__)]
|
|
42
|
+
self._named[name] = [*kept, Registered(function, file)]
|
|
43
|
+
|
|
44
|
+
def key(self, function: Callable[..., Any] | str) -> tuple[str, str]:
|
|
45
|
+
"""The key a function goes by, and the name it is shown by: a registered name as it is; a function itself, a key
|
|
46
|
+
of its own that resolves to that very function (even when another function is registered under its name), shown
|
|
47
|
+
by the name it is registered under, else its qualified name."""
|
|
48
|
+
if isinstance(function, str):
|
|
49
|
+
return function, function
|
|
50
|
+
if not callable(function):
|
|
51
|
+
raise TypeError(f"expected a function or the name {self.decorator} registered one under, not {type(function).__name__}")
|
|
52
|
+
registered = (name for name, entries in self._named.items() if any(entry.function is function for entry in entries))
|
|
53
|
+
shown = next(registered, getattr(function, "__qualname__", type(function).__name__))
|
|
54
|
+
key = f"{shown}#{id(function):x}"
|
|
55
|
+
self._passed[key] = (function, shown)
|
|
56
|
+
return key, shown
|
|
57
|
+
|
|
58
|
+
def release(self) -> None:
|
|
59
|
+
"""Let go of the functions passed as themselves, once the run that passed them finished."""
|
|
60
|
+
self._passed.clear()
|
|
61
|
+
|
|
62
|
+
def lookup(self, key: str, root: Path | None = None) -> tuple[Callable[..., Any] | None, str | None]:
|
|
63
|
+
"""The function registered under `key` (or passed as itself), or why there is none: no function has the name (the
|
|
64
|
+
registered ones listed), or two have it (their files named, relative to `root`)."""
|
|
65
|
+
if key in self._passed:
|
|
66
|
+
return self._passed[key][0], None
|
|
67
|
+
entries = self._named.get(key, [])
|
|
68
|
+
if len(entries) == 1:
|
|
69
|
+
return entries[0].function, None
|
|
70
|
+
if entries:
|
|
71
|
+
files = " and ".join(f"{_shown(entry.file, root)} ({entry.function.__qualname__})" for entry in entries)
|
|
72
|
+
return None, f'{len(entries)} functions are registered as {key}, in {files}; give one another name with {self.decorator}("...")'
|
|
73
|
+
names = ", ".join(sorted(self._named))
|
|
74
|
+
if not names:
|
|
75
|
+
return None, f'no function is registered as {key}: decorate one with {self.decorator}, or {self.decorator}("{key}") to give it that name'
|
|
76
|
+
return None, f"no function is registered as {key} with {self.decorator}; the registered ones are {names}"
|
|
77
|
+
|
|
78
|
+
def shown(self, key: str) -> str:
|
|
79
|
+
"""The name `key` is shown by in errors: a passed function's, else the key itself."""
|
|
80
|
+
passed = self._passed.get(key)
|
|
81
|
+
return passed[1] if passed is not None else key
|
|
82
|
+
|
|
83
|
+
def source_file(self, key: str) -> str | None:
|
|
84
|
+
"""The file the function `key` names is defined in."""
|
|
85
|
+
function, _ = self.lookup(key)
|
|
86
|
+
return _file(function) if function is not None else None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _file(function: Callable[..., Any]) -> str:
|
|
90
|
+
"""The file `function` is defined in, resolved; empty when Python can't tell."""
|
|
91
|
+
try:
|
|
92
|
+
path = inspect.getsourcefile(function) or inspect.getfile(function)
|
|
93
|
+
except TypeError:
|
|
94
|
+
return ""
|
|
95
|
+
return str(Path(path).resolve())
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _shown(file: str, root: Path | None) -> str:
|
|
99
|
+
"""`file` relative to the project folder `root` when it is under it."""
|
|
100
|
+
path = Path(file)
|
|
101
|
+
if root is not None and root in path.parents:
|
|
102
|
+
return path.relative_to(root).as_posix()
|
|
103
|
+
return file
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""`@sl.transform`: a function that reshapes each file, Google Sheets range or `sl.http` page before it loads.
|
|
2
|
+
|
|
3
|
+
`sqlload.toml` picks one by the name it is registered under (`transform = "kpi_sheet"`); an `sl.http` job takes the name
|
|
4
|
+
or the function itself (`api.paginate(..., transform=kpi_page)`). SQLLoad reads the unit, calls `f(rows, ctx)` with its
|
|
5
|
+
rows as a pyarrow Table, and loads what the function returns or yields.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from collections.abc import Callable, Iterator
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from datetime import datetime
|
|
11
|
+
from typing import Any, TypeVar, overload
|
|
12
|
+
|
|
13
|
+
from sqlload_api._registry import Registry
|
|
14
|
+
|
|
15
|
+
_Function = TypeVar("_Function", bound=Callable[..., Any])
|
|
16
|
+
|
|
17
|
+
#: The functions `@sl.transform` registered, by name.
|
|
18
|
+
TRANSFORMS = Registry("@sl.transform")
|
|
19
|
+
|
|
20
|
+
#: What a transform may return or yield, for its errors.
|
|
21
|
+
RETURNS = "dicts, lists of dicts, a pyarrow Table, or a polars or pandas DataFrame"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@overload
|
|
25
|
+
def transform(function: _Function, /) -> _Function: ...
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@overload
|
|
29
|
+
def transform(name: str | None = None, /) -> Callable[[_Function], _Function]: ...
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def transform(function: Any = None, /) -> Any:
|
|
33
|
+
"""Register a transform under its own name (`@sl.transform`) or another (`@sl.transform("kpis")`), for
|
|
34
|
+
`transform = "..."` in `sqlload.toml` or `transform=` on an `sl.http` job to pick. Returns the function unchanged."""
|
|
35
|
+
if function is None or isinstance(function, str):
|
|
36
|
+
name = function
|
|
37
|
+
|
|
38
|
+
def register(decorated: _Function) -> _Function:
|
|
39
|
+
TRANSFORMS.register(name or decorated.__name__, decorated)
|
|
40
|
+
return decorated
|
|
41
|
+
|
|
42
|
+
return register
|
|
43
|
+
TRANSFORMS.register(function.__name__, function)
|
|
44
|
+
return function
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class TransformContext:
|
|
49
|
+
"""What a transform receives with the rows: the unit they came from.
|
|
50
|
+
|
|
51
|
+
`unit` is `"file"`, `"range"` or `"page"`. A file sets `path` (as `_sqlload_source_file` names it,
|
|
52
|
+
`archive.zip/member.csv` for a ZIP member), `modified_at`, and `sheet`, `range` or `skip_rows` when its format uses
|
|
53
|
+
them. A Google Sheets range sets `spreadsheet_id`, `sheet` (the tab) and `range`. An `sl.http` page sets `page`
|
|
54
|
+
(counted from 1 within its request) and, in a fan-out, `key`: the fields of the key it was requested for.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
unit: str
|
|
58
|
+
table: str
|
|
59
|
+
path: str | None = None
|
|
60
|
+
modified_at: datetime | None = None
|
|
61
|
+
sheet: str | None = None
|
|
62
|
+
range: str | None = None
|
|
63
|
+
skip_rows: int | None = None
|
|
64
|
+
spreadsheet_id: str | None = None
|
|
65
|
+
page: int | None = None
|
|
66
|
+
key: dict[str, Any] | None = None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class Returned:
|
|
70
|
+
"""What a transform returned or yielded, one item at a time, each checked; `dicts` says whether any were dicts."""
|
|
71
|
+
|
|
72
|
+
def __init__(self, name: str, items: Iterator[Any]) -> None:
|
|
73
|
+
self._name = name
|
|
74
|
+
self._items = items
|
|
75
|
+
self.dicts = False
|
|
76
|
+
|
|
77
|
+
def __iter__(self) -> "Returned":
|
|
78
|
+
return self
|
|
79
|
+
|
|
80
|
+
def __next__(self) -> Any:
|
|
81
|
+
item = next(self._items)
|
|
82
|
+
if isinstance(item, dict) or (isinstance(item, list) and all(isinstance(row, dict) for row in item)):
|
|
83
|
+
self.dicts = True
|
|
84
|
+
return item
|
|
85
|
+
if _arrow(item):
|
|
86
|
+
return item
|
|
87
|
+
raise TypeError(f"transform {self._name} yielded {_kind(item)}; yield {RETURNS}")
|
|
88
|
+
|
|
89
|
+
def close(self) -> None:
|
|
90
|
+
"""Close a generator the load stopped reading, so its `finally` blocks run now."""
|
|
91
|
+
close = getattr(self._items, "close", None)
|
|
92
|
+
if callable(close):
|
|
93
|
+
close()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def returned_items(name: str, returned: Any) -> tuple[Returned | None, str | None]:
|
|
97
|
+
"""What `returned` crosses as, or why it can't load: a list of dicts, a dict, Arrow data or a DataFrame crosses as one
|
|
98
|
+
item; an iterator (a generator) crosses item by item as it yields."""
|
|
99
|
+
if isinstance(returned, list) and all(isinstance(row, dict) for row in returned):
|
|
100
|
+
return Returned(name, iter([returned] if returned else [])), None
|
|
101
|
+
if isinstance(returned, dict) or _arrow(returned):
|
|
102
|
+
return Returned(name, iter([returned])), None
|
|
103
|
+
if isinstance(returned, Iterator):
|
|
104
|
+
return Returned(name, returned), None
|
|
105
|
+
return None, f"it returned {_kind(returned)}; return or yield {RETURNS}"
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _arrow(value: Any) -> bool:
|
|
109
|
+
return hasattr(value, "__arrow_c_stream__") or hasattr(value, "__arrow_c_array__")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _kind(value: Any) -> str:
|
|
113
|
+
return "a list holding something other than dicts" if isinstance(value, list) else type(value).__name__
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"""The wire every engine reads, pinned: one item of each kind a loader yields, and what each crosses as.
|
|
2
|
+
|
|
3
|
+
`CASES` builds each item through an `http` client its caller makes (`make_http(**options)`: SQLLoad's `sl.http(source,
|
|
4
|
+
...)`, or a context's `http(...)` in another tool), and `expected(name)` is what it must cross as, as committed here.
|
|
5
|
+
Building every case both ways and comparing with `expected` proves the two give the engine the same items; the engine's own
|
|
6
|
+
tests parse every expected item.
|
|
7
|
+
|
|
8
|
+
Set `SQLLOAD_UPDATE_WIRE=1` when running `sqlload_api`'s tests to rewrite the expected files from the cases.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
from collections.abc import Callable, Mapping
|
|
13
|
+
from importlib import resources
|
|
14
|
+
from typing import Any
|
|
15
|
+
|
|
16
|
+
from sqlload_api import _data
|
|
17
|
+
from sqlload_api import _http as sl
|
|
18
|
+
from sqlload_api._data import field, key, parent
|
|
19
|
+
|
|
20
|
+
#: Builds an `http` client for the cases: `make_http(headers=...)` and `make_http()`.
|
|
21
|
+
MakeHttp = Callable[..., sl.Http]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def crossed(item: Any) -> Any:
|
|
25
|
+
"""What `item` crosses into the engine as, parsed: a job's definition, a JSON item's text and read, a checkpoint's state."""
|
|
26
|
+
if hasattr(item, "__sqlload_http_job__"):
|
|
27
|
+
return {"job": json.loads(item.__sqlload_http_job__())}
|
|
28
|
+
if hasattr(item, "__sqlload_json__"):
|
|
29
|
+
data, read = item.__sqlload_json__()
|
|
30
|
+
return {"json": {"data": bytes(data).decode(), "read": json.loads(read)}}
|
|
31
|
+
if hasattr(item, "__sqlload_checkpoint__"):
|
|
32
|
+
return {"checkpoint": json.loads(item.__sqlload_checkpoint__())}
|
|
33
|
+
raise TypeError(f"{type(item).__name__} does not cross as a job, JSON data or a checkpoint")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def expected(name: str) -> Any:
|
|
37
|
+
"""What case `name` must cross as."""
|
|
38
|
+
return json.loads(resources.files(__package__).joinpath(f"{name}.json").read_text())
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _paginate_next_link(make_http: MakeHttp) -> Any:
|
|
42
|
+
return make_http().paginate("/orders", paginator=sl.next_link("$.next"), select="$.items")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _paginate_link_header(make_http: MakeHttp) -> Any:
|
|
46
|
+
api = make_http(headers={"Accept": "application/json"})
|
|
47
|
+
return api.paginate("/orders", paginator=sl.link_header(), select="$", on_status={404: "skip"})
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _paginate_offset(make_http: MakeHttp) -> Any:
|
|
51
|
+
paginator = sl.offset("start", limit=100, limit_param="count", read_ahead=4)
|
|
52
|
+
return make_http().paginate("/orders", paginator=paginator, params={"status": "open"}, select="$.data")
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _paginate_page_number_post(make_http: MakeHttp) -> Any:
|
|
56
|
+
paginator = sl.page_number("$.page.number", page_size=50, page_size_param="$.page.size", location="body")
|
|
57
|
+
body = {"filter": {"status": "open"}, "page": {}}
|
|
58
|
+
return make_http().paginate("/search", paginator=paginator, method="POST", json_body=body, select="$.results")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _paginate_cursor(make_http: MakeHttp) -> Any:
|
|
62
|
+
return make_http().paginate("/events", paginator=sl.cursor("$.next_token", "token"), select="$.events")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _paginate_projected(make_http: MakeHttp) -> Any:
|
|
66
|
+
fields: Mapping[str, Any] = {
|
|
67
|
+
"id": "$.id",
|
|
68
|
+
"city": field("$.address.city", required=True),
|
|
69
|
+
"updated_at": field("$.updated", parse="epoch_ms", on_error="null"),
|
|
70
|
+
"page_total": parent("$.total", levels=2),
|
|
71
|
+
}
|
|
72
|
+
return make_http().paginate(
|
|
73
|
+
"/accounts",
|
|
74
|
+
paginator=sl.single(),
|
|
75
|
+
select="$.data.items",
|
|
76
|
+
fields=fields,
|
|
77
|
+
keep_record="raw",
|
|
78
|
+
select_missing="empty",
|
|
79
|
+
error_path="$.errors",
|
|
80
|
+
transform="account_page",
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _paginate_cells(make_http: MakeHttp) -> Any:
|
|
85
|
+
cells = sl.cells("$.cells", value=["$.value", "$.displayValue"], name=sl.listed("$.columns"))
|
|
86
|
+
return make_http().paginate("/sheets/1", paginator=sl.single(), select="$.rows", cells=cells)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def _paginate_header_row(make_http: MakeHttp) -> Any:
|
|
90
|
+
cells = sl.cells("$.values", value="$", name=sl.header_row())
|
|
91
|
+
return make_http().paginate("/values/A1:Z", paginator=sl.single(), select="$.rows", cells=cells)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _fan_out_values(make_http: MakeHttp) -> Any:
|
|
95
|
+
return make_http().fan_out("/regions/{region}/stock", over=["north", "south"], concurrency=2, select="$.items")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _fan_out_nested(make_http: MakeHttp) -> Any:
|
|
99
|
+
api = make_http()
|
|
100
|
+
orders = api.paginate("/orders", paginator=sl.next_link("$.next"), select="$.items[*].id", key="order_id")
|
|
101
|
+
items = api.fan_out("/orders/{order_id}/items", over=orders, select="$.items[*].id", key="item_id")
|
|
102
|
+
fields = {"order_id": key("order_id"), "item_id": key("item_id"), "sku": "$.sku"}
|
|
103
|
+
return api.fan_out("/orders/{order_id}/items/{item_id}/parts", over=items, select="$.parts", fields=fields)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _fan_out_batch(make_http: MakeHttp) -> Any:
|
|
107
|
+
api = make_http()
|
|
108
|
+
issues = api.paginate("/issues", paginator=sl.offset(limit=50), select="$.issues[*].id")
|
|
109
|
+
return api.fan_out(
|
|
110
|
+
"/comments",
|
|
111
|
+
over=issues,
|
|
112
|
+
method="POST",
|
|
113
|
+
json_body={"ids": "{id}"},
|
|
114
|
+
batch=100,
|
|
115
|
+
concurrency=4,
|
|
116
|
+
select="$.comments",
|
|
117
|
+
key_path=parent("$.issueId"),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _json_document(_: MakeHttp) -> Any:
|
|
122
|
+
return _data.json('{"data": {"items": [{"id": 1}]}}', path="data.items", fields={"id": "$.id"}, keep_record="raw")
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _ndjson_lines(_: MakeHttp) -> Any:
|
|
126
|
+
return _data.ndjson(b'{"id": 1}\n{"id": 2}\n', fields={"id": field("$.id", required=True)})
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _checkpoint(_: MakeHttp) -> Any:
|
|
130
|
+
return _data.checkpoint({"page": 3, "token": "abc"})
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
#: Each case's name and how it is built.
|
|
134
|
+
CASES: dict[str, Callable[[MakeHttp], Any]] = {
|
|
135
|
+
"paginate_next_link": _paginate_next_link,
|
|
136
|
+
"paginate_link_header": _paginate_link_header,
|
|
137
|
+
"paginate_offset": _paginate_offset,
|
|
138
|
+
"paginate_page_number_post": _paginate_page_number_post,
|
|
139
|
+
"paginate_cursor": _paginate_cursor,
|
|
140
|
+
"paginate_projected": _paginate_projected,
|
|
141
|
+
"paginate_cells": _paginate_cells,
|
|
142
|
+
"paginate_header_row": _paginate_header_row,
|
|
143
|
+
"fan_out_values": _fan_out_values,
|
|
144
|
+
"fan_out_nested": _fan_out_nested,
|
|
145
|
+
"fan_out_batch": _fan_out_batch,
|
|
146
|
+
"json_document": _json_document,
|
|
147
|
+
"ndjson_lines": _ndjson_lines,
|
|
148
|
+
"checkpoint": _checkpoint,
|
|
149
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"batch": 100,
|
|
4
|
+
"client": {
|
|
5
|
+
"connection": "shop_api",
|
|
6
|
+
"headers": {}
|
|
7
|
+
},
|
|
8
|
+
"concurrency": 4,
|
|
9
|
+
"fields": null,
|
|
10
|
+
"json_body": {
|
|
11
|
+
"ids": "{id}"
|
|
12
|
+
},
|
|
13
|
+
"keep_record": null,
|
|
14
|
+
"key_path": {
|
|
15
|
+
"from": {
|
|
16
|
+
"kind": "parent",
|
|
17
|
+
"levels": 1
|
|
18
|
+
},
|
|
19
|
+
"path": "$.issueId"
|
|
20
|
+
},
|
|
21
|
+
"kind": "fan_out",
|
|
22
|
+
"method": "POST",
|
|
23
|
+
"on_status": {},
|
|
24
|
+
"over": {
|
|
25
|
+
"client": {
|
|
26
|
+
"connection": "shop_api",
|
|
27
|
+
"headers": {}
|
|
28
|
+
},
|
|
29
|
+
"fields": null,
|
|
30
|
+
"json_body": null,
|
|
31
|
+
"keep_record": null,
|
|
32
|
+
"kind": "paginate",
|
|
33
|
+
"method": "GET",
|
|
34
|
+
"on_status": {},
|
|
35
|
+
"paginator": {
|
|
36
|
+
"kind": "offset",
|
|
37
|
+
"limit": 50,
|
|
38
|
+
"limit_param": "limit",
|
|
39
|
+
"location": "query",
|
|
40
|
+
"param": "offset"
|
|
41
|
+
},
|
|
42
|
+
"params": {},
|
|
43
|
+
"path": "/issues",
|
|
44
|
+
"select": "$.issues[*].id"
|
|
45
|
+
},
|
|
46
|
+
"paginator": {
|
|
47
|
+
"kind": "single"
|
|
48
|
+
},
|
|
49
|
+
"params": {},
|
|
50
|
+
"path": "/comments",
|
|
51
|
+
"select": "$.comments"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"client": {
|
|
4
|
+
"connection": "shop_api",
|
|
5
|
+
"headers": {}
|
|
6
|
+
},
|
|
7
|
+
"concurrency": 8,
|
|
8
|
+
"fields": [
|
|
9
|
+
{
|
|
10
|
+
"from": {
|
|
11
|
+
"kind": "key",
|
|
12
|
+
"name": "order_id"
|
|
13
|
+
},
|
|
14
|
+
"name": "order_id",
|
|
15
|
+
"path": "$",
|
|
16
|
+
"required": false
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"from": {
|
|
20
|
+
"kind": "key",
|
|
21
|
+
"name": "item_id"
|
|
22
|
+
},
|
|
23
|
+
"name": "item_id",
|
|
24
|
+
"path": "$",
|
|
25
|
+
"required": false
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "sku",
|
|
29
|
+
"path": "$.sku",
|
|
30
|
+
"required": false
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"json_body": null,
|
|
34
|
+
"keep_record": null,
|
|
35
|
+
"kind": "fan_out",
|
|
36
|
+
"method": "GET",
|
|
37
|
+
"on_status": {},
|
|
38
|
+
"over": {
|
|
39
|
+
"client": {
|
|
40
|
+
"connection": "shop_api",
|
|
41
|
+
"headers": {}
|
|
42
|
+
},
|
|
43
|
+
"concurrency": 8,
|
|
44
|
+
"fields": null,
|
|
45
|
+
"json_body": null,
|
|
46
|
+
"keep_record": null,
|
|
47
|
+
"key": "item_id",
|
|
48
|
+
"kind": "fan_out",
|
|
49
|
+
"method": "GET",
|
|
50
|
+
"on_status": {},
|
|
51
|
+
"over": {
|
|
52
|
+
"client": {
|
|
53
|
+
"connection": "shop_api",
|
|
54
|
+
"headers": {}
|
|
55
|
+
},
|
|
56
|
+
"fields": null,
|
|
57
|
+
"json_body": null,
|
|
58
|
+
"keep_record": null,
|
|
59
|
+
"key": "order_id",
|
|
60
|
+
"kind": "paginate",
|
|
61
|
+
"method": "GET",
|
|
62
|
+
"on_status": {},
|
|
63
|
+
"paginator": {
|
|
64
|
+
"kind": "next_link",
|
|
65
|
+
"pointer": "$.next"
|
|
66
|
+
},
|
|
67
|
+
"params": {},
|
|
68
|
+
"path": "/orders",
|
|
69
|
+
"select": "$.items[*].id"
|
|
70
|
+
},
|
|
71
|
+
"paginator": {
|
|
72
|
+
"kind": "single"
|
|
73
|
+
},
|
|
74
|
+
"params": {},
|
|
75
|
+
"path": "/orders/{order_id}/items",
|
|
76
|
+
"select": "$.items[*].id"
|
|
77
|
+
},
|
|
78
|
+
"paginator": {
|
|
79
|
+
"kind": "single"
|
|
80
|
+
},
|
|
81
|
+
"params": {},
|
|
82
|
+
"path": "/orders/{order_id}/items/{item_id}/parts",
|
|
83
|
+
"select": "$.parts"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"client": {
|
|
4
|
+
"connection": "shop_api",
|
|
5
|
+
"headers": {}
|
|
6
|
+
},
|
|
7
|
+
"concurrency": 2,
|
|
8
|
+
"fields": null,
|
|
9
|
+
"json_body": null,
|
|
10
|
+
"keep_record": null,
|
|
11
|
+
"kind": "fan_out",
|
|
12
|
+
"method": "GET",
|
|
13
|
+
"on_status": {},
|
|
14
|
+
"over": {
|
|
15
|
+
"kind": "values",
|
|
16
|
+
"values": [
|
|
17
|
+
"north",
|
|
18
|
+
"south"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"paginator": {
|
|
22
|
+
"kind": "single"
|
|
23
|
+
},
|
|
24
|
+
"params": {},
|
|
25
|
+
"path": "/regions/{region}/stock",
|
|
26
|
+
"select": "$.items"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"json": {
|
|
3
|
+
"data": "{\"data\": {\"items\": [{\"id\": 1}]}}",
|
|
4
|
+
"read": {
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"name": "id",
|
|
8
|
+
"path": "$.id",
|
|
9
|
+
"required": false
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"keep_record": "raw",
|
|
13
|
+
"layout": "document",
|
|
14
|
+
"path": "data.items"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"cells": {
|
|
4
|
+
"name": {
|
|
5
|
+
"from": "$.columns",
|
|
6
|
+
"id_key": "id",
|
|
7
|
+
"key": "columnId",
|
|
8
|
+
"kind": "listed",
|
|
9
|
+
"name_key": "title"
|
|
10
|
+
},
|
|
11
|
+
"pointer": "$.cells",
|
|
12
|
+
"value": [
|
|
13
|
+
"$.value",
|
|
14
|
+
"$.displayValue"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"client": {
|
|
18
|
+
"connection": "shop_api",
|
|
19
|
+
"headers": {}
|
|
20
|
+
},
|
|
21
|
+
"fields": null,
|
|
22
|
+
"json_body": null,
|
|
23
|
+
"keep_record": null,
|
|
24
|
+
"kind": "paginate",
|
|
25
|
+
"method": "GET",
|
|
26
|
+
"on_status": {},
|
|
27
|
+
"paginator": {
|
|
28
|
+
"kind": "single"
|
|
29
|
+
},
|
|
30
|
+
"params": {},
|
|
31
|
+
"path": "/sheets/1",
|
|
32
|
+
"select": "$.rows"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"client": {
|
|
4
|
+
"connection": "shop_api",
|
|
5
|
+
"headers": {}
|
|
6
|
+
},
|
|
7
|
+
"fields": null,
|
|
8
|
+
"json_body": null,
|
|
9
|
+
"keep_record": null,
|
|
10
|
+
"kind": "paginate",
|
|
11
|
+
"method": "GET",
|
|
12
|
+
"on_status": {},
|
|
13
|
+
"paginator": {
|
|
14
|
+
"kind": "cursor",
|
|
15
|
+
"location": "query",
|
|
16
|
+
"param": "token",
|
|
17
|
+
"pointer": "$.next_token"
|
|
18
|
+
},
|
|
19
|
+
"params": {},
|
|
20
|
+
"path": "/events",
|
|
21
|
+
"select": "$.events"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"job": {
|
|
3
|
+
"cells": {
|
|
4
|
+
"name": {
|
|
5
|
+
"kind": "header_row"
|
|
6
|
+
},
|
|
7
|
+
"pointer": "$.values",
|
|
8
|
+
"value": [
|
|
9
|
+
"$"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"client": {
|
|
13
|
+
"connection": "shop_api",
|
|
14
|
+
"headers": {}
|
|
15
|
+
},
|
|
16
|
+
"fields": null,
|
|
17
|
+
"json_body": null,
|
|
18
|
+
"keep_record": null,
|
|
19
|
+
"kind": "paginate",
|
|
20
|
+
"method": "GET",
|
|
21
|
+
"on_status": {},
|
|
22
|
+
"paginator": {
|
|
23
|
+
"kind": "single"
|
|
24
|
+
},
|
|
25
|
+
"params": {},
|
|
26
|
+
"path": "/values/A1:Z",
|
|
27
|
+
"select": "$.rows"
|
|
28
|
+
}
|
|
29
|
+
}
|