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
{{ message }}
This repository was archived by the owner on May 17, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -201,6 +201,57 @@ Options:
201
201
-`--bisection-factor` - Segments per iteration. When set to 2, it performs binary search.
202
202
-`--bisection-threshold` - Minimal bisection threshold. i.e. maximum size of pages to diff locally.
203
203
-`-j` or `--threads` - Number of worker threads to use per database. Default=1.
204
+
-`--conf`, `--run` - Specify the run and configuration from a TOML file. (see below)
205
+
206
+
### How to use with a configuration file
207
+
208
+
Data-diff lets you load the configuration for a run from a TOML file.
209
+
210
+
Reasons to use a configuration file:
211
+
212
+
- Convenience - Set-up the parameters for diffs that need to run often
213
+
214
+
- Easier and more readable - you can define the database connection settings as config values, instead of in a URI.
215
+
216
+
- Gives you fine-grained control over the settings switches, without requiring any Python code.
217
+
218
+
Use `--conf` to specify that path to the configuration file. data-diff will load the settings from `run.default`, if it's defined.
219
+
220
+
Then you can, optionally, use `--run` to choose to load the settings of a specific run, and override the settings `run.default`. (all runs extend `run.default`, like inheritance).
221
+
222
+
Finally, CLI switches have the final say, and will override the settings defined by the configuration file, and the current run.
223
+
224
+
Example TOML file:
225
+
226
+
```toml
227
+
# Specify the connection params to the test database.
228
+
[database.test_postgresql]
229
+
driver = "postgresql"
230
+
user = "postgres"
231
+
password = "Password1"
232
+
233
+
# Specify the default run params
234
+
[run.default]
235
+
update_column = "timestamp"
236
+
verbose = true
237
+
238
+
# Specify params for a run 'test_diff'.
239
+
[run.test_diff]
240
+
verbose = false
241
+
# Source 1 ("left")
242
+
1.database = "test_postgresql"# Use options from database.test_postgresql
243
+
1.table = "rating"
244
+
# Source 2 ("right")
245
+
2.database = "postgresql://postgres:Password1@/"# Use URI like in the CLI
246
+
2.table = "rating_del1"
247
+
```
248
+
249
+
In this example, running `data-diff --conf myconfig.toml --run test_diff` will compare between `rating` and `rating_del1`.
250
+
It will use the `timestamp` column as the update column, as specified in `run.default`. However, it won't be verbose, since that
251
+
flag is overwritten to `false`.
252
+
253
+
Running it with `data-diff --conf myconfig.toml --run test_diff -v` will set verbose back to `true`.
0 commit comments