google-pso-data-validator 5.1.0__tar.gz → 6.0.0__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.
Files changed (82) hide show
  1. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/PKG-INFO +27 -4
  2. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/README.md +26 -3
  3. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/__main__.py +49 -37
  4. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/cli_tools.py +105 -220
  5. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/clients.py +10 -2
  6. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/config_manager.py +92 -27
  7. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/consts.py +1 -0
  8. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/data_validation.py +7 -0
  9. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/partition_builder.py +79 -42
  10. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/validation_builder.py +3 -4
  11. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/PKG-INFO +27 -4
  12. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/setup.py +1 -1
  13. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_addon/operations.py +14 -21
  14. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/registry.py +3 -0
  15. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_oracle/__init__.py +8 -1
  16. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_oracle/datatypes.py +6 -0
  17. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_oracle/registry.py +38 -3
  18. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_teradata/__init__.py +9 -10
  19. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/LICENSE +0 -0
  20. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/__init__.py +0 -0
  21. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/app.py +0 -0
  22. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/client_info.py +0 -0
  23. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/combiner.py +0 -0
  24. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/exceptions.py +0 -0
  25. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/gcs_helper.py +0 -0
  26. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/jellyfish_distance.py +0 -0
  27. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/metadata.py +0 -0
  28. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/query_builder/__init__.py +0 -0
  29. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/query_builder/partition_row_builder.py +0 -0
  30. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/query_builder/query_builder.py +0 -0
  31. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/query_builder/random_row_builder.py +0 -0
  32. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/result_handlers/__init__.py +0 -0
  33. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/result_handlers/bigquery.py +0 -0
  34. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/result_handlers/text.py +0 -0
  35. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/schema_validation.py +0 -0
  36. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/secret_manager.py +0 -0
  37. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/data_validation/state_manager.py +0 -0
  38. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/SOURCES.txt +0 -0
  39. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/dependency_links.txt +0 -0
  40. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/entry_points.txt +0 -0
  41. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/requires.txt +0 -0
  42. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/google_pso_data_validator.egg-info/top_level.txt +0 -0
  43. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/setup.cfg +0 -0
  44. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_addon/__init__.py +0 -0
  45. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_addon/api.py +0 -0
  46. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/__init__.py +0 -0
  47. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/api.py +0 -0
  48. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/client.py +0 -0
  49. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/compiler.py +0 -0
  50. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/datatypes.py +0 -0
  51. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/tests/__init__.py +0 -0
  52. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/tests/conftest.py +0 -0
  53. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_cloud_spanner/to_pandas.py +0 -0
  54. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_db2/__init__.py +0 -0
  55. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_db2/api.py +0 -0
  56. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_db2/compiler.py +0 -0
  57. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_db2/datatypes.py +0 -0
  58. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_db2/registry.py +0 -0
  59. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_impala/__init__.py +0 -0
  60. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_impala/api.py +0 -0
  61. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mssql/__init__.py +0 -0
  62. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mssql/api.py +0 -0
  63. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mssql/datatypes.py +0 -0
  64. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mysql/__init__.py +0 -0
  65. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mysql/base_sql_compiler/__init__.py +0 -0
  66. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mysql/base_sql_compiler/select_builder.py +0 -0
  67. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_mysql/compiler.py +0 -0
  68. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_oracle/api.py +0 -0
  69. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_oracle/compiler.py +0 -0
  70. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_postgres/__init__.py +0 -0
  71. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_postgres/client.py +0 -0
  72. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_postgres/datatypes.py +0 -0
  73. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_redshift/__init__.py +0 -0
  74. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_redshift/api.py +0 -0
  75. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_redshift/compiler.py +0 -0
  76. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_snowflake/__init__.py +0 -0
  77. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_snowflake/api.py +0 -0
  78. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_snowflake/datatypes.py +0 -0
  79. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_teradata/api.py +0 -0
  80. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_teradata/compiler.py +0 -0
  81. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_teradata/datatypes.py +0 -0
  82. {google_pso_data_validator-5.1.0 → google_pso_data_validator-6.0.0}/third_party/ibis/ibis_teradata/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: google-pso-data-validator
3
- Version: 5.1.0
3
+ Version: 6.0.0
4
4
  Summary: A package to enable easy data validation
5
5
  Author: PSO DVT Engineering team
6
6
  Author-email: data-validator-eng@google.com
@@ -256,12 +256,14 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
256
256
  Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
257
257
  [--trim-string-pks, -tsp]
258
258
  Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
259
+ [--case-insensitive-match, -cim]
260
+ Performs a case insensitive match by adding an UPPER() before comparison.
259
261
  ```
260
262
  #### Generate Table Partitions for Large Table Row Validations
261
263
 
262
264
  When performing row validations, Data Validation Tool brings each row into memory and can run into MemoryError. Below is the command syntax for generating table partitions in order to perform row validations on large tables to alleviate MemoryError. Each partition contains a range of primary key(s) and the ranges of keys across partitions are distinct. The partitions have nearly equal number of rows. See *Primary Keys* section
263
265
 
264
- The command generates and stores multiple YAML configs that represent chunks of the large table using filters (`WHERE primary_key(s) >= X AND primary_key(s) < Y`). You can then run the configs in the directory serially (or in parallel in multiple containers, VMs) with the `data-validation configs run --config-dir PATH` command as described [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator#yaml-configuration-files).
266
+ The command generates and stores multiple YAML validations each representing a chunk of the large table using filters (`WHERE primary_key(s) >= X AND primary_key(s) < Y`) in one YAML file. The parameter parts-per-file, specifies the number of validations in one YAML file. Each yaml file will have parts-per-file validations in it - except the last one which will contain the remaining partitions (i.e. parts-per-file may not divide partition-num evenly). You can then run the validations in the directory serially (or in parallel in multiple containers, VMs) with the `data-validation configs run --config-dir PATH` command as described [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator#yaml-configuration-files).
265
267
 
266
268
  The command takes the same parameters as required for `Row Validation` *plus* a few parameters to support partitioning. Single and multiple primary keys are supported and keys can be of any indexable type, except for date and timestamp type. A parameter used in earlier versions, ```partition-key``` is no longer supported.
267
269
 
@@ -289,13 +291,30 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
289
291
  Directory Path to store YAML Config Files
290
292
  GCS: Provide a full gs:// path of the target directory. Eg: `gs://<BUCKET>/partitions_dir`
291
293
  Local: Provide a relative path of the target directory. Eg: `partitions_dir`
292
- --partition-num [1-1000], -pn [1-1000]
293
- Number of partitions/config files to generate
294
+ --partition-num INT, -pn INT
295
+ Number of partitions into which the table should be split, e.g. 1000 or 10000
294
296
  In case this value exceeds the row count of the source/target table, it will be decreased to max(source_row_count, target_row_count)
297
+ [--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
298
+ BigQuery destination for validation results. Defaults to stdout.
299
+ See: *Validation Reports* section
300
+ [--service-account or -sa PATH_TO_SA_KEY]
301
+ Service account to use for BigQuery result handler output.
302
+ [--parts-per-file INT], [-ppf INT]
303
+ Number of partitions in a yaml file, default value 1.
295
304
  [--filters SOURCE_FILTER:TARGET_FILTER]
296
305
  Colon separated string values of source and target filters.
297
306
  If target filter is not provided, the source filter will run on source and target tables.
298
307
  See: *Filters* section
308
+ [--labels or -l KEY1=VALUE1,KEY2=VALUE2]
309
+ Comma-separated key value pair labels for the run.
310
+ [--format or -fmt FORMAT]
311
+ Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
312
+ [--filter-status or -fs STATUSES_LIST]
313
+ Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
314
+ [--trim-string-pks, -tsp]
315
+ Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
316
+ [--case-insensitive-match, -cim]
317
+ Performs a case insensitive match by adding an UPPER() before comparison.
299
318
  ```
300
319
  #### Schema Validations
301
320
 
@@ -449,6 +468,10 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
449
468
  Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
450
469
  [--filter-status or -fs STATUSES_LIST]
451
470
  Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
471
+ [--trim-string-pks, -tsp]
472
+ Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
473
+ [--case-insensitive-match, -cim]
474
+ Performs a case insensitive match by adding an UPPER() before comparison.
452
475
  ```
453
476
 
454
477
  The [Examples](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/examples.md)
@@ -210,12 +210,14 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
210
210
  Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
211
211
  [--trim-string-pks, -tsp]
212
212
  Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
213
+ [--case-insensitive-match, -cim]
214
+ Performs a case insensitive match by adding an UPPER() before comparison.
213
215
  ```
214
216
  #### Generate Table Partitions for Large Table Row Validations
215
217
 
216
218
  When performing row validations, Data Validation Tool brings each row into memory and can run into MemoryError. Below is the command syntax for generating table partitions in order to perform row validations on large tables to alleviate MemoryError. Each partition contains a range of primary key(s) and the ranges of keys across partitions are distinct. The partitions have nearly equal number of rows. See *Primary Keys* section
217
219
 
218
- The command generates and stores multiple YAML configs that represent chunks of the large table using filters (`WHERE primary_key(s) >= X AND primary_key(s) < Y`). You can then run the configs in the directory serially (or in parallel in multiple containers, VMs) with the `data-validation configs run --config-dir PATH` command as described [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator#yaml-configuration-files).
220
+ The command generates and stores multiple YAML validations each representing a chunk of the large table using filters (`WHERE primary_key(s) >= X AND primary_key(s) < Y`) in one YAML file. The parameter parts-per-file, specifies the number of validations in one YAML file. Each yaml file will have parts-per-file validations in it - except the last one which will contain the remaining partitions (i.e. parts-per-file may not divide partition-num evenly). You can then run the validations in the directory serially (or in parallel in multiple containers, VMs) with the `data-validation configs run --config-dir PATH` command as described [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator#yaml-configuration-files).
219
221
 
220
222
  The command takes the same parameters as required for `Row Validation` *plus* a few parameters to support partitioning. Single and multiple primary keys are supported and keys can be of any indexable type, except for date and timestamp type. A parameter used in earlier versions, ```partition-key``` is no longer supported.
221
223
 
@@ -243,13 +245,30 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
243
245
  Directory Path to store YAML Config Files
244
246
  GCS: Provide a full gs:// path of the target directory. Eg: `gs://<BUCKET>/partitions_dir`
245
247
  Local: Provide a relative path of the target directory. Eg: `partitions_dir`
246
- --partition-num [1-1000], -pn [1-1000]
247
- Number of partitions/config files to generate
248
+ --partition-num INT, -pn INT
249
+ Number of partitions into which the table should be split, e.g. 1000 or 10000
248
250
  In case this value exceeds the row count of the source/target table, it will be decreased to max(source_row_count, target_row_count)
251
+ [--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
252
+ BigQuery destination for validation results. Defaults to stdout.
253
+ See: *Validation Reports* section
254
+ [--service-account or -sa PATH_TO_SA_KEY]
255
+ Service account to use for BigQuery result handler output.
256
+ [--parts-per-file INT], [-ppf INT]
257
+ Number of partitions in a yaml file, default value 1.
249
258
  [--filters SOURCE_FILTER:TARGET_FILTER]
250
259
  Colon separated string values of source and target filters.
251
260
  If target filter is not provided, the source filter will run on source and target tables.
252
261
  See: *Filters* section
262
+ [--labels or -l KEY1=VALUE1,KEY2=VALUE2]
263
+ Comma-separated key value pair labels for the run.
264
+ [--format or -fmt FORMAT]
265
+ Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
266
+ [--filter-status or -fs STATUSES_LIST]
267
+ Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
268
+ [--trim-string-pks, -tsp]
269
+ Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
270
+ [--case-insensitive-match, -cim]
271
+ Performs a case insensitive match by adding an UPPER() before comparison.
253
272
  ```
254
273
  #### Schema Validations
255
274
 
@@ -403,6 +422,10 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
403
422
  Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
404
423
  [--filter-status or -fs STATUSES_LIST]
405
424
  Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
425
+ [--trim-string-pks, -tsp]
426
+ Trims string based primary key values, intended for use when one engine uses padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n)).
427
+ [--case-insensitive-match, -cim]
428
+ Performs a case insensitive match by adding an UPPER() before comparison.
406
429
  ```
407
430
 
408
431
  The [Examples](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/examples.md)
@@ -160,7 +160,7 @@ def get_aggregate_config(args, config_manager: ConfigManager):
160
160
  return aggregate_configs
161
161
 
162
162
 
163
- def get_calculated_config(args, config_manager):
163
+ def get_calculated_config(args, config_manager) -> List[dict]:
164
164
  """Return list of formatted calculated objects.
165
165
 
166
166
  Args:
@@ -290,6 +290,17 @@ def build_config_from_args(args: Namespace, config_manager: ConfigManager):
290
290
  comparison_fields = cli_tools.get_arg_list(
291
291
  args.comparison_fields, default_value=[]
292
292
  )
293
+
294
+ # As per #1190, add rstrip for Teradata string comparison fields
295
+ if (
296
+ config_manager.source_client.name == "teradata"
297
+ or config_manager.target_client.name == "teradata"
298
+ ):
299
+
300
+ comparison_fields = config_manager.add_rstrip_to_comp_fields(
301
+ comparison_fields
302
+ )
303
+
293
304
  config_manager.append_comparison_fields(
294
305
  config_manager.build_config_comparison_fields(comparison_fields)
295
306
  )
@@ -531,49 +542,49 @@ def run_validation(config_manager, dry_run=False, verbose=False):
531
542
  dry_run (bool): Print source and target SQL to stdout in lieu of validation.
532
543
  verbose (bool): Validation setting to log queries run.
533
544
  """
534
- validator = DataValidation(
545
+ with DataValidation(
535
546
  config_manager.config,
536
547
  validation_builder=None,
537
548
  result_handler=None,
538
549
  verbose=verbose,
539
- )
540
-
541
- if dry_run:
542
- sql_alchemy_clients = [
543
- "mysql",
544
- "oracle",
545
- "postgres",
546
- "db2",
547
- "mssql",
548
- "redshift",
549
- "snowflake",
550
- ]
551
-
552
- source_query = validator.validation_builder.get_source_query().compile()
553
- if config_manager.source_client.name in sql_alchemy_clients:
554
- source_query = source_query.compile(
555
- config_manager.source_client.con.engine,
556
- compile_kwargs={"literal_binds": True},
557
- )
550
+ ) as validator:
551
+
552
+ if dry_run:
553
+ sql_alchemy_clients = [
554
+ "mysql",
555
+ "oracle",
556
+ "postgres",
557
+ "db2",
558
+ "mssql",
559
+ "redshift",
560
+ "snowflake",
561
+ ]
562
+
563
+ source_query = validator.validation_builder.get_source_query().compile()
564
+ if config_manager.source_client.name in sql_alchemy_clients:
565
+ source_query = source_query.compile(
566
+ config_manager.source_client.con.engine,
567
+ compile_kwargs={"literal_binds": True},
568
+ )
558
569
 
559
- target_query = validator.validation_builder.get_target_query().compile()
560
- if config_manager.target_client.name in sql_alchemy_clients:
561
- target_query = target_query.compile(
562
- config_manager.target_client.con.engine,
563
- compile_kwargs={"literal_binds": True},
564
- )
570
+ target_query = validator.validation_builder.get_target_query().compile()
571
+ if config_manager.target_client.name in sql_alchemy_clients:
572
+ target_query = target_query.compile(
573
+ config_manager.target_client.con.engine,
574
+ compile_kwargs={"literal_binds": True},
575
+ )
565
576
 
566
- print(
567
- json.dumps(
568
- {
569
- "source_query": str(source_query),
570
- "target_query": str(target_query),
571
- },
572
- indent=4,
577
+ print(
578
+ json.dumps(
579
+ {
580
+ "source_query": str(source_query),
581
+ "target_query": str(target_query),
582
+ },
583
+ indent=4,
584
+ )
573
585
  )
574
- )
575
- else:
576
- validator.execute()
586
+ else:
587
+ validator.execute()
577
588
 
578
589
 
579
590
  def run_validations(args, config_managers):
@@ -715,6 +726,7 @@ def main():
715
726
  elif args.command == "validate":
716
727
  validate(args)
717
728
  elif args.command == "generate-table-partitions":
729
+ cli_tools.check_no_yaml_files(args.partition_num, args.parts_per_file)
718
730
  partition_and_store_config_files(args)
719
731
  elif args.command == "deploy":
720
732
  from data_validation import app