You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,19 @@ count:
64
64
separator: ,
65
65
fetch:
66
66
page_size: 100
67
+
validate:
68
+
methods:
69
+
- schema # checks that payloads conform to the Swagger definitions from the API
70
+
- descriptors # checks that descriptor values are either locally-defined or exist in the remote API
71
+
- uniqueness # checks that local payloads are unique by the required property values
72
+
- references # checks that references resolve, either locally or in the remote API
73
+
# or `methods: "*"`
74
+
references:
75
+
selector:
76
+
- studentAssessments.studentReference
77
+
- studentSchoolAssociations.schoolReference
78
+
behavior: exclude # or `include`
79
+
remote: False # default=True
67
80
force_delete: True
68
81
log_level: INFO
69
82
show_stacktrace: True
@@ -94,6 +107,7 @@ show_stacktrace: True
94
107
* (optional) Whether to `verify_ssl`. The default is `True`. Set to `False` when working with `localhost` APIs or to live dangerously.
95
108
* (optional) for [`lightbeam count`](#count), optionally change the `separator` between `Records` and `Endpoint`. The default is a "tab" character.
96
109
* (optional) for [`lightbeam fetch`](#fetch), optionally specify the number of records (`page_size`) to GET at a time. The default is 100, but if you're trying to extract lots of data from an API increase this to the largest allowed (which depends on the API, but is often 500 or even 5000).
110
+
* (optional) for [`lightbeam validate`](#validate), optionally specify the list of validation `methods` to run (from `schema`, `descriptors`, `uniqueness`, and `references`). If validating `references`, specify a list of `selector`s to either `include` or `exclude` (`behavior`) when validating. Also optionally disable `remote` referece validation (enabled by default).
97
111
* (optional) Skip the interactive confirmation prompt (for programmatic use) when using the [`delete`](#delete) command. The default is `False` (prompt).
98
112
* (optional) Specify a `log_level` for output. Possible values are
99
113
- `ERROR`: only output errors like missing required sources, invalid references, invalid [YAML configuration](#yaml-configuration), etc.
@@ -147,6 +161,12 @@ validate:
147
161
- references # checks that references resolve, either locally or in the remote API
148
162
# or
149
163
# methods: "*"
164
+
references:
165
+
selector:
166
+
- studentAssessments.studentReference
167
+
- studentSchoolAssociations.schoolReference
168
+
behavior: exclude # or `include`
169
+
remote: False # default=True
150
170
```
151
171
Default `validate`.`methods` are `["schema", "descriptors", "uniqueness"]` (not `references`; see below). In addition to the above methods, `lighteam validate` will also (first) check that each payload is valid JSON.
152
172
@@ -167,6 +187,8 @@ This is optional; if absent, references in every payload are checked, no matter
167
187
* `fetch`ed data becoming stale over time
168
188
* needing to track which data is your own vs. was `fetch`ed (all the data must coexist in the `config.data_dir` to be discoverable by `lightbeam validate`)
169
189
190
+
You may specify a `selector` list of the form `someEndpoint.path.to.someReference` to include or exclude (according to `behavior`) specific references from reference validation. You may also specity `remote: False` to only validate references against local data in your JSONL files.
191
+
170
192
171
193
## `send`
172
194
```bash
@@ -209,6 +231,17 @@ Running the `truncate` command will prompt you to type "yes" to confirm. This co
209
231
210
232
`truncate`is a convenience command which should be used sparingly, as it can generate large numbers of `deletes` records and cause performance issues when pulling from `deletes` endpoints. If you want to wipe an entire Ed-Fi ODS, a better approach may be to drop and recreate the database (and re-send Descriptors and other default resources as needed).
Creates a skeleton of an [`earthmover`](https://edanalytics.github.io/earthmover/) project for _creating_ JSONL Ed-Fi data which one can then `lightbeam send` to an Ed-Fi API. It uses the Ed-Fi API's [OpenAPI specification](https://spec.openapis.org/oas/latest.html) to determine the schema of the endpoints you select (`lightbeam create` should usually be used with the `-s` [selector](#selectors)). Then, in the current directory, it:
239
+
* creates (if it doesn't already exist, otherwise adds/overwrites) a partial `earthmover.yml` configuration file with empty `sources` and `transformations` but `destinations` for each selected endpoint, plus comments indicating what column names and data types/values are required, and the required grain of the table (based on `isIdentity` flags in the OpenAPI definitions)
240
+
* creates (or overwrites) `templates/*.jsont` for each selected endpoint, with skeleton Jinja-JSON that includes all the required fields (including nested ones), optional fields wrapped in conditionals, and comments with some of the property metadata from OpenAPI definitions, such as `type`, `description`, `isIdentity`, etc.
241
+
242
+
The purpose of `lightbeam create` is to save developers time if they want to use `earthmover` to create Ed-Fi-shaped data from other data sources. See the [`earthmover` documentation](https://edanalytics.github.io/earthmover/) for more information.
243
+
244
+
212
245
## Other options
213
246
See a help message with
214
247
```bash
@@ -222,6 +255,14 @@ lightbeam -v
222
255
lightbeam --version
223
256
```
224
257
258
+
Override specific configurations in `lightbeam.yml` from the command-line using the `--set` flag
self.logger.error(f"`config.validate.references.selector` {selector} is incorrectly formatted (should be `someEndpoint.someReference`, such as `studentSchoolAssociation.schoolReference`)")
0 commit comments