google-pso-data-validator 4.5.0__tar.gz → 5.1.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.
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/PKG-INFO +30 -32
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/README.md +23 -23
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/__main__.py +16 -10
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/cli_tools.py +58 -36
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/clients.py +17 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/config_manager.py +25 -11
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/consts.py +2 -1
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/data_validation.py +31 -14
- google_pso_data_validator-5.1.0/data_validation/gcs_helper.py +94 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/partition_builder.py +28 -28
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/query_builder/query_builder.py +26 -7
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/secret_manager.py +5 -0
- google_pso_data_validator-5.1.0/data_validation/state_manager.py +126 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/validation_builder.py +34 -4
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/PKG-INFO +30 -32
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/SOURCES.txt +1 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/requires.txt +3 -4
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/setup.py +7 -9
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_addon/operations.py +116 -7
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_db2/registry.py +2 -1
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_impala/api.py +6 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_teradata/datatypes.py +7 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_teradata/registry.py +34 -1
- google-pso-data-validator-4.5.0/data_validation/state_manager.py +0 -277
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/LICENSE +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/app.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/client_info.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/combiner.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/exceptions.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/jellyfish_distance.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/metadata.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/query_builder/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/query_builder/partition_row_builder.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/query_builder/random_row_builder.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/result_handlers/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/result_handlers/bigquery.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/result_handlers/text.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/schema_validation.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/dependency_links.txt +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/entry_points.txt +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/google_pso_data_validator.egg-info/top_level.txt +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/setup.cfg +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_addon/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_addon/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/client.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/compiler.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/registry.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/tests/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/tests/conftest.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_cloud_spanner/to_pandas.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_db2/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_db2/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_db2/compiler.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_db2/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_impala/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mssql/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mssql/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mssql/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mysql/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mysql/base_sql_compiler/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mysql/base_sql_compiler/select_builder.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_mysql/compiler.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_oracle/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_oracle/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_oracle/compiler.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_oracle/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_oracle/registry.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_postgres/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_postgres/client.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_postgres/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_redshift/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_redshift/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_redshift/compiler.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_snowflake/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_snowflake/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_snowflake/datatypes.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_teradata/__init__.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_teradata/api.py +0 -0
- {google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/third_party/ibis/ibis_teradata/compiler.py +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-pso-data-validator
|
|
3
|
-
Version:
|
|
3
|
+
Version: 5.1.0
|
|
4
4
|
Summary: A package to enable easy data validation
|
|
5
|
-
|
|
6
|
-
Author:
|
|
7
|
-
|
|
8
|
-
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Author: PSO DVT Engineering team
|
|
6
|
+
Author-email: data-validator-eng@google.com
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
8
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
9
|
Classifier: Programming Language :: Python
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.8
|
|
@@ -16,7 +15,7 @@ Requires-Python: >=3.8
|
|
|
16
15
|
Description-Content-Type: text/markdown
|
|
17
16
|
License-File: LICENSE
|
|
18
17
|
Requires-Dist: attrs==23.1.0
|
|
19
|
-
Requires-Dist: grpcio==1.53.
|
|
18
|
+
Requires-Dist: grpcio==1.53.2
|
|
20
19
|
Requires-Dist: lazy-object-proxy==1.9.0
|
|
21
20
|
Requires-Dist: marshmallow==3.19.0
|
|
22
21
|
Requires-Dist: fsspec>=2022.8.2
|
|
@@ -24,7 +23,7 @@ Requires-Dist: google-api-python-client==2.91.0
|
|
|
24
23
|
Requires-Dist: ibis-framework==5.1.0
|
|
25
24
|
Requires-Dist: impyla==0.18.0
|
|
26
25
|
Requires-Dist: SQLAlchemy==1.4.49
|
|
27
|
-
Requires-Dist: PyMySQL==1.1.
|
|
26
|
+
Requires-Dist: PyMySQL==1.1.1
|
|
28
27
|
Requires-Dist: psycopg2-binary==2.9.6
|
|
29
28
|
Requires-Dist: PyYAML==6.0
|
|
30
29
|
Requires-Dist: pandas==1.5.3
|
|
@@ -35,12 +34,11 @@ Requires-Dist: google-cloud-bigquery==3.11.3
|
|
|
35
34
|
Requires-Dist: google-cloud-bigquery-storage==2.20.0
|
|
36
35
|
Requires-Dist: google-cloud-spanner==3.36.0
|
|
37
36
|
Requires-Dist: google-cloud-storage==2.10.0
|
|
38
|
-
Requires-Dist: setuptools>=34.0.0
|
|
39
37
|
Requires-Dist: jellyfish==1.0.0
|
|
40
38
|
Requires-Dist: tabulate==0.9.0
|
|
41
39
|
Requires-Dist: Flask==2.3.2
|
|
42
40
|
Requires-Dist: parsy==2.1
|
|
43
|
-
Requires-Dist: google-cloud-secret-manager
|
|
41
|
+
Requires-Dist: google-cloud-secret-manager>=2.16.0
|
|
44
42
|
Provides-Extra: apache-airflow
|
|
45
43
|
Requires-Dist: 1.10.11; extra == "apache-airflow"
|
|
46
44
|
Provides-Extra: pyspark
|
|
@@ -172,7 +170,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
172
170
|
If target filter is not provided, the source filter will run on source and target tables.
|
|
173
171
|
See: *Filters* section
|
|
174
172
|
[--config-file or -c CONFIG_FILE]
|
|
175
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
173
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
176
174
|
See: *Running DVT with YAML Configuration Files* section
|
|
177
175
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
178
176
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -242,7 +240,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
242
240
|
If target filter is not provided, the source filter will run on source and target tables.
|
|
243
241
|
See: *Filters* section
|
|
244
242
|
[--config-file or -c CONFIG_FILE]
|
|
245
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
243
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
246
244
|
See: *Running DVT with YAML Configuration Files* section
|
|
247
245
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
248
246
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -256,6 +254,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
256
254
|
Row batch size used for random row filters (default 10,000).
|
|
257
255
|
[--filter-status or -fs STATUSES_LIST]
|
|
258
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
|
+
[--trim-string-pks, -tsp]
|
|
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
259
|
```
|
|
260
260
|
#### Generate Table Partitions for Large Table Row Validations
|
|
261
261
|
|
|
@@ -322,7 +322,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
322
322
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
323
323
|
Service account to use for BigQuery result handler output.
|
|
324
324
|
[--config-file or -c CONFIG_FILE]
|
|
325
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
325
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
326
326
|
See: *Running DVT with YAML Configuration Files* section
|
|
327
327
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
328
328
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -357,19 +357,19 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query col
|
|
|
357
357
|
Source sql query
|
|
358
358
|
Either --source-query or --source-query-file must be provided
|
|
359
359
|
--source-query-file SOURCE_QUERY_FILE, -sqf SOURCE_QUERY_FILE
|
|
360
|
-
File containing the source sql
|
|
360
|
+
File containing the source sql command. Supports GCS and local paths.
|
|
361
361
|
--target-query TARGET_QUERY, -tq TARGET_QUERY
|
|
362
362
|
Target sql query
|
|
363
363
|
Either --target-query or --target-query-file must be provided
|
|
364
364
|
--target-query-file TARGET_QUERY_FILE, -tqf TARGET_QUERY_FILE
|
|
365
|
-
File containing the target sql
|
|
365
|
+
File containing the target sql command. Supports GCS and local paths.
|
|
366
366
|
[--count COLUMNS] Comma separated list of columns for count or * for all columns
|
|
367
367
|
[--sum COLUMNS] Comma separated list of columns for sum or * for all numeric
|
|
368
368
|
[--min COLUMNS] Comma separated list of columns for min or * for all numeric
|
|
369
369
|
[--max COLUMNS] Comma separated list of columns for max or * for all numeric
|
|
370
370
|
[--avg COLUMNS] Comma separated list of columns for avg or * for all numeric
|
|
371
371
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
372
|
-
[--exclude-columns or -ec]
|
|
372
|
+
[--exclude-columns or -ec]
|
|
373
373
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
374
374
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
375
375
|
BigQuery destination for validation results. Defaults to stdout.
|
|
@@ -377,7 +377,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query col
|
|
|
377
377
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
378
378
|
Service account to use for BigQuery result handler output.
|
|
379
379
|
[--config-file or -c CONFIG_FILE]
|
|
380
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
380
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
381
381
|
See: *Running DVT with YAML Configuration Files* section
|
|
382
382
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
383
383
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -419,12 +419,12 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
419
419
|
Source sql query
|
|
420
420
|
Either --source-query or --source-query-file must be provided
|
|
421
421
|
--source-query-file SOURCE_QUERY_FILE, -sqf SOURCE_QUERY_FILE
|
|
422
|
-
File containing the source sql
|
|
422
|
+
File containing the source sql command. Supports GCS and local paths.
|
|
423
423
|
--target-query TARGET_QUERY, -tq TARGET_QUERY
|
|
424
424
|
Target sql query
|
|
425
425
|
Either --target-query or --target-query-file must be provided
|
|
426
426
|
--target-query-file TARGET_QUERY_FILE, -tqf TARGET_QUERY_FILE
|
|
427
|
-
File containing the target sql
|
|
427
|
+
File containing the target sql command. Supports GCS and local paths.
|
|
428
428
|
--comparison-fields or -comp-fields FIELDS
|
|
429
429
|
Comma separated list of columns to compare. Can either be a physical column or an alias
|
|
430
430
|
See: *Calculated Fields* section for details
|
|
@@ -439,7 +439,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
439
439
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
440
440
|
Service account to use for BigQuery result handler output.
|
|
441
441
|
[--config-file or -c CONFIG_FILE]
|
|
442
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
442
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
443
443
|
See: *Running DVT with YAML Configuration Files* section
|
|
444
444
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
445
445
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -483,11 +483,10 @@ For example, this flag can be used as follows:
|
|
|
483
483
|
|
|
484
484
|
Running DVT with YAML configuration files is the recommended approach if:
|
|
485
485
|
* you want to customize the configuration for any given validation OR
|
|
486
|
-
* you want to run DVT at scale (i.e.
|
|
486
|
+
* you want to run DVT at scale (i.e. run multiple validations sequentially or in parallel)
|
|
487
487
|
|
|
488
|
-
We recommend generating YAML configs with the `--config-file <file-name>` flag when running a validation command
|
|
489
|
-
|
|
490
|
-
otherwise, it is saved to wherever the tool is run.
|
|
488
|
+
We recommend generating YAML configs with the `--config-file <file-name>` flag when running a validation command, which supports
|
|
489
|
+
GCS and local paths.
|
|
491
490
|
|
|
492
491
|
You can use the `data-validation configs` command to run and view YAMLs.
|
|
493
492
|
|
|
@@ -500,7 +499,7 @@ data-validation (--verbose or -v) (--log-level or -ll) configs run
|
|
|
500
499
|
[--dry-run or -dr] If this flag is present, prints the source and target SQL generated in lieu of running the validation.
|
|
501
500
|
[--kube-completions or -kc]
|
|
502
501
|
Flag to indicate usage in Kubernetes index completion mode.
|
|
503
|
-
See *Scaling DVT
|
|
502
|
+
See *Scaling DVT* section
|
|
504
503
|
```
|
|
505
504
|
|
|
506
505
|
```
|
|
@@ -518,19 +517,17 @@ View the complete YAML file for a Grouped Column validation on the
|
|
|
518
517
|
[Examples](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/examples.md#sample-yaml-config-grouped-column-validation) page.
|
|
519
518
|
|
|
520
519
|
|
|
521
|
-
|
|
520
|
+
### Scaling DVT
|
|
522
521
|
|
|
523
|
-
|
|
522
|
+
You can scale DVT for large table validations by running the tool in a distributed manner. To optimize the validation speed for large tables, you can use GKE Jobs ([Google Kubernetes Jobs](https://cloud.google.com/kubernetes-engine/docs/how-to/deploying-workloads-overview#batch_jobs)) or [Cloud Run Jobs](https://cloud.google.com/run/docs/create-jobs). If you are not familiar with Kubernetes or Cloud Run Jobs, see [Scaling DVT with Distributed Jobs](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/internal/distributed_jobs.md) for a detailed overview.
|
|
524
523
|
|
|
525
|
-
In order to validate partitions concurrently, both the `--kube-completions` and `--config-dir` flags are required. The `--kube-completions` flag specifies that the validation is being run in indexed completion mode in Kubernetes or as multiple independent tasks in Cloud Run. The `--config-dir` flag will specify the directory with the YAML files to be executed in parallel. If you used `generate-table-partitions` to generate the YAMLs, this would be the directory where the partition files numbered `0000.yaml` to `<partition_num - 1>.yaml` are stored i.e (`my_config_dir/source_schema.source_table/`)
|
|
526
524
|
|
|
527
|
-
|
|
525
|
+
We recommend first generating table partitions with the `generate-table-partitions` command for your large tables. Then, use Cloud Run or GKE to distribute validating each chunk in parallel. See the [Cloud Run Jobs Quickstart sample](https://github.com/GoogleCloudPlatform/professional-services-data-validator/tree/develop/samples/cloud_run_jobs) to get started.
|
|
528
526
|
|
|
529
|
-
|
|
527
|
+
When running DVT in a distributed fashion, both the `--kube-completions` and `--config-dir` flags are required. The `--kube-completions` flag specifies that the validation is being run in indexed completion mode in Kubernetes or as multiple independent tasks in Cloud Run. If the `-kc` option is used and you are not running in indexed mode, you will receive a warning and the container will process all the validations sequentially. If the `-kc` option is used and a config directory is not provided (i.e. a `--config-file` is provided instead), a warning is issued.
|
|
530
528
|
|
|
531
|
-
|
|
529
|
+
The `--config-dir` flag will specify the directory with the YAML files to be executed in parallel. If you used `generate-table-partitions` to generate the YAMLs, this would be the directory where the partition files numbered `0000.yaml` to `<partition_num - 1>.yaml` are stored i.e (`gs://my_config_dir/source_schema.source_table/`). When creating your Cloud Run Job, set the number of tasks equal to the number of table partitions so the task index matches the YAML file to be validated. When executed, each Cloud Run task will validate a partition in parallel.
|
|
532
530
|
|
|
533
|
-
By default, each partition validation is retried up to 3 times if there is an error. In Kubernetes and Cloud Run, you can set the parallelism to the number you want. Keep in mind that if you are validating 1000's of partitions in parallel, you may find that setting the parallelism too high (say 100) may result in timeouts and slow down the validation.
|
|
534
531
|
|
|
535
532
|
### Validation Reports
|
|
536
533
|
|
|
@@ -635,7 +632,8 @@ with calculated fields as shown in [this example](https://github.com/GoogleCloud
|
|
|
635
632
|
|
|
636
633
|
Filters let you apply a WHERE statement to your validation query (ie. `SELECT *
|
|
637
634
|
FROM table WHERE created_at > 30 days ago AND region_id = 71;`). The filter is
|
|
638
|
-
written in the syntax of the given source
|
|
635
|
+
written in the syntax of the given source and must reference columns in the
|
|
636
|
+
underlying table, not projected DVT expressions.
|
|
639
637
|
|
|
640
638
|
Note that you are writing the query to execute, which does not have to match
|
|
641
639
|
between source and target as long as the results can be expected to align. If
|
|
@@ -124,7 +124,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
124
124
|
If target filter is not provided, the source filter will run on source and target tables.
|
|
125
125
|
See: *Filters* section
|
|
126
126
|
[--config-file or -c CONFIG_FILE]
|
|
127
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
127
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
128
128
|
See: *Running DVT with YAML Configuration Files* section
|
|
129
129
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
130
130
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -194,7 +194,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
194
194
|
If target filter is not provided, the source filter will run on source and target tables.
|
|
195
195
|
See: *Filters* section
|
|
196
196
|
[--config-file or -c CONFIG_FILE]
|
|
197
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
197
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
198
198
|
See: *Running DVT with YAML Configuration Files* section
|
|
199
199
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
200
200
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -208,6 +208,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
208
208
|
Row batch size used for random row filters (default 10,000).
|
|
209
209
|
[--filter-status or -fs STATUSES_LIST]
|
|
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
|
+
[--trim-string-pks, -tsp]
|
|
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)).
|
|
211
213
|
```
|
|
212
214
|
#### Generate Table Partitions for Large Table Row Validations
|
|
213
215
|
|
|
@@ -274,7 +276,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
274
276
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
275
277
|
Service account to use for BigQuery result handler output.
|
|
276
278
|
[--config-file or -c CONFIG_FILE]
|
|
277
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
279
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
278
280
|
See: *Running DVT with YAML Configuration Files* section
|
|
279
281
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
280
282
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -309,19 +311,19 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query col
|
|
|
309
311
|
Source sql query
|
|
310
312
|
Either --source-query or --source-query-file must be provided
|
|
311
313
|
--source-query-file SOURCE_QUERY_FILE, -sqf SOURCE_QUERY_FILE
|
|
312
|
-
File containing the source sql
|
|
314
|
+
File containing the source sql command. Supports GCS and local paths.
|
|
313
315
|
--target-query TARGET_QUERY, -tq TARGET_QUERY
|
|
314
316
|
Target sql query
|
|
315
317
|
Either --target-query or --target-query-file must be provided
|
|
316
318
|
--target-query-file TARGET_QUERY_FILE, -tqf TARGET_QUERY_FILE
|
|
317
|
-
File containing the target sql
|
|
319
|
+
File containing the target sql command. Supports GCS and local paths.
|
|
318
320
|
[--count COLUMNS] Comma separated list of columns for count or * for all columns
|
|
319
321
|
[--sum COLUMNS] Comma separated list of columns for sum or * for all numeric
|
|
320
322
|
[--min COLUMNS] Comma separated list of columns for min or * for all numeric
|
|
321
323
|
[--max COLUMNS] Comma separated list of columns for max or * for all numeric
|
|
322
324
|
[--avg COLUMNS] Comma separated list of columns for avg or * for all numeric
|
|
323
325
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
324
|
-
[--exclude-columns or -ec]
|
|
326
|
+
[--exclude-columns or -ec]
|
|
325
327
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
326
328
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
327
329
|
BigQuery destination for validation results. Defaults to stdout.
|
|
@@ -329,7 +331,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query col
|
|
|
329
331
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
330
332
|
Service account to use for BigQuery result handler output.
|
|
331
333
|
[--config-file or -c CONFIG_FILE]
|
|
332
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
334
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
333
335
|
See: *Running DVT with YAML Configuration Files* section
|
|
334
336
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
335
337
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -371,12 +373,12 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
371
373
|
Source sql query
|
|
372
374
|
Either --source-query or --source-query-file must be provided
|
|
373
375
|
--source-query-file SOURCE_QUERY_FILE, -sqf SOURCE_QUERY_FILE
|
|
374
|
-
File containing the source sql
|
|
376
|
+
File containing the source sql command. Supports GCS and local paths.
|
|
375
377
|
--target-query TARGET_QUERY, -tq TARGET_QUERY
|
|
376
378
|
Target sql query
|
|
377
379
|
Either --target-query or --target-query-file must be provided
|
|
378
380
|
--target-query-file TARGET_QUERY_FILE, -tqf TARGET_QUERY_FILE
|
|
379
|
-
File containing the target sql
|
|
381
|
+
File containing the target sql command. Supports GCS and local paths.
|
|
380
382
|
--comparison-fields or -comp-fields FIELDS
|
|
381
383
|
Comma separated list of columns to compare. Can either be a physical column or an alias
|
|
382
384
|
See: *Calculated Fields* section for details
|
|
@@ -391,7 +393,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
391
393
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
392
394
|
Service account to use for BigQuery result handler output.
|
|
393
395
|
[--config-file or -c CONFIG_FILE]
|
|
394
|
-
YAML Config File Path to be used for storing validations and other features.
|
|
396
|
+
YAML Config File Path to be used for storing validations and other features. Supports GCS and local paths.
|
|
395
397
|
See: *Running DVT with YAML Configuration Files* section
|
|
396
398
|
[--config-file-json or -cj CONFIG_FILE_JSON]
|
|
397
399
|
JSON Config File Path to be used for storing validations only for application purposes.
|
|
@@ -435,11 +437,10 @@ For example, this flag can be used as follows:
|
|
|
435
437
|
|
|
436
438
|
Running DVT with YAML configuration files is the recommended approach if:
|
|
437
439
|
* you want to customize the configuration for any given validation OR
|
|
438
|
-
* you want to run DVT at scale (i.e.
|
|
440
|
+
* you want to run DVT at scale (i.e. run multiple validations sequentially or in parallel)
|
|
439
441
|
|
|
440
|
-
We recommend generating YAML configs with the `--config-file <file-name>` flag when running a validation command
|
|
441
|
-
|
|
442
|
-
otherwise, it is saved to wherever the tool is run.
|
|
442
|
+
We recommend generating YAML configs with the `--config-file <file-name>` flag when running a validation command, which supports
|
|
443
|
+
GCS and local paths.
|
|
443
444
|
|
|
444
445
|
You can use the `data-validation configs` command to run and view YAMLs.
|
|
445
446
|
|
|
@@ -452,7 +453,7 @@ data-validation (--verbose or -v) (--log-level or -ll) configs run
|
|
|
452
453
|
[--dry-run or -dr] If this flag is present, prints the source and target SQL generated in lieu of running the validation.
|
|
453
454
|
[--kube-completions or -kc]
|
|
454
455
|
Flag to indicate usage in Kubernetes index completion mode.
|
|
455
|
-
See *Scaling DVT
|
|
456
|
+
See *Scaling DVT* section
|
|
456
457
|
```
|
|
457
458
|
|
|
458
459
|
```
|
|
@@ -470,19 +471,17 @@ View the complete YAML file for a Grouped Column validation on the
|
|
|
470
471
|
[Examples](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/examples.md#sample-yaml-config-grouped-column-validation) page.
|
|
471
472
|
|
|
472
473
|
|
|
473
|
-
|
|
474
|
+
### Scaling DVT
|
|
474
475
|
|
|
475
|
-
|
|
476
|
+
You can scale DVT for large table validations by running the tool in a distributed manner. To optimize the validation speed for large tables, you can use GKE Jobs ([Google Kubernetes Jobs](https://cloud.google.com/kubernetes-engine/docs/how-to/deploying-workloads-overview#batch_jobs)) or [Cloud Run Jobs](https://cloud.google.com/run/docs/create-jobs). If you are not familiar with Kubernetes or Cloud Run Jobs, see [Scaling DVT with Distributed Jobs](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/docs/internal/distributed_jobs.md) for a detailed overview.
|
|
476
477
|
|
|
477
|
-
In order to validate partitions concurrently, both the `--kube-completions` and `--config-dir` flags are required. The `--kube-completions` flag specifies that the validation is being run in indexed completion mode in Kubernetes or as multiple independent tasks in Cloud Run. The `--config-dir` flag will specify the directory with the YAML files to be executed in parallel. If you used `generate-table-partitions` to generate the YAMLs, this would be the directory where the partition files numbered `0000.yaml` to `<partition_num - 1>.yaml` are stored i.e (`my_config_dir/source_schema.source_table/`)
|
|
478
478
|
|
|
479
|
-
|
|
479
|
+
We recommend first generating table partitions with the `generate-table-partitions` command for your large tables. Then, use Cloud Run or GKE to distribute validating each chunk in parallel. See the [Cloud Run Jobs Quickstart sample](https://github.com/GoogleCloudPlatform/professional-services-data-validator/tree/develop/samples/cloud_run_jobs) to get started.
|
|
480
480
|
|
|
481
|
-
|
|
481
|
+
When running DVT in a distributed fashion, both the `--kube-completions` and `--config-dir` flags are required. The `--kube-completions` flag specifies that the validation is being run in indexed completion mode in Kubernetes or as multiple independent tasks in Cloud Run. If the `-kc` option is used and you are not running in indexed mode, you will receive a warning and the container will process all the validations sequentially. If the `-kc` option is used and a config directory is not provided (i.e. a `--config-file` is provided instead), a warning is issued.
|
|
482
482
|
|
|
483
|
-
|
|
483
|
+
The `--config-dir` flag will specify the directory with the YAML files to be executed in parallel. If you used `generate-table-partitions` to generate the YAMLs, this would be the directory where the partition files numbered `0000.yaml` to `<partition_num - 1>.yaml` are stored i.e (`gs://my_config_dir/source_schema.source_table/`). When creating your Cloud Run Job, set the number of tasks equal to the number of table partitions so the task index matches the YAML file to be validated. When executed, each Cloud Run task will validate a partition in parallel.
|
|
484
484
|
|
|
485
|
-
By default, each partition validation is retried up to 3 times if there is an error. In Kubernetes and Cloud Run, you can set the parallelism to the number you want. Keep in mind that if you are validating 1000's of partitions in parallel, you may find that setting the parallelism too high (say 100) may result in timeouts and slow down the validation.
|
|
486
485
|
|
|
487
486
|
### Validation Reports
|
|
488
487
|
|
|
@@ -587,7 +586,8 @@ with calculated fields as shown in [this example](https://github.com/GoogleCloud
|
|
|
587
586
|
|
|
588
587
|
Filters let you apply a WHERE statement to your validation query (ie. `SELECT *
|
|
589
588
|
FROM table WHERE created_at > 30 days ago AND region_id = 71;`). The filter is
|
|
590
|
-
written in the syntax of the given source
|
|
589
|
+
written in the syntax of the given source and must reference columns in the
|
|
590
|
+
underlying table, not projected DVT expressions.
|
|
591
591
|
|
|
592
592
|
Note that you are writing the query to execute, which does not have to match
|
|
593
593
|
between source and target as long as the results can be expected to align. If
|
{google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/__main__.py
RENAMED
|
@@ -48,7 +48,10 @@ def _get_arg_config_file(args):
|
|
|
48
48
|
"""Return String YAML config file path."""
|
|
49
49
|
if not args.config_file:
|
|
50
50
|
raise ValueError("YAML Config File was not supplied.")
|
|
51
|
-
|
|
51
|
+
elif not args.config_file.endswith(".yaml"):
|
|
52
|
+
raise ValueError(
|
|
53
|
+
f"Invalid YAML config name: {args.config_file}. Provide YAML file extension."
|
|
54
|
+
)
|
|
52
55
|
return args.config_file
|
|
53
56
|
|
|
54
57
|
|
|
@@ -56,7 +59,10 @@ def _get_arg_config_file_json(args):
|
|
|
56
59
|
"""Return String JSON config file path."""
|
|
57
60
|
if not args.config_file_json:
|
|
58
61
|
raise ValueError("JSON Config File was not supplied.")
|
|
59
|
-
|
|
62
|
+
elif not args.config_file_json.endswith(".json"):
|
|
63
|
+
raise ValueError(
|
|
64
|
+
f"Invalid JSON config name: {args.config_file_json}. Provide JSON file extension."
|
|
65
|
+
)
|
|
60
66
|
return args.config_file_json
|
|
61
67
|
|
|
62
68
|
|
|
@@ -350,16 +356,17 @@ def config_runner(args):
|
|
|
350
356
|
setattr(args, "config_dir", None)
|
|
351
357
|
setattr(args, "config_file", config_file_path)
|
|
352
358
|
config_managers = build_config_managers_from_yaml(args, config_file_path)
|
|
359
|
+
run_validations(args, config_managers)
|
|
353
360
|
else:
|
|
354
361
|
if args.kube_completions:
|
|
355
362
|
logging.warning(
|
|
356
363
|
"--kube-completions or -kc specified, however not running in Kubernetes Job completion, check your command line."
|
|
357
364
|
)
|
|
358
|
-
|
|
359
|
-
config_file_names = mgr.list_validations_in_dir(args.config_dir)
|
|
365
|
+
config_file_names = cli_tools.list_validations(config_dir=args.config_dir)
|
|
360
366
|
config_managers = []
|
|
361
367
|
for file in config_file_names:
|
|
362
|
-
config_managers
|
|
368
|
+
config_managers = build_config_managers_from_yaml(args, file)
|
|
369
|
+
run_validations(args, config_managers)
|
|
363
370
|
else:
|
|
364
371
|
if args.kube_completions:
|
|
365
372
|
logging.warning(
|
|
@@ -367,13 +374,12 @@ def config_runner(args):
|
|
|
367
374
|
)
|
|
368
375
|
config_file_path = _get_arg_config_file(args)
|
|
369
376
|
config_managers = build_config_managers_from_yaml(args, config_file_path)
|
|
370
|
-
|
|
371
|
-
run_validations(args, config_managers)
|
|
377
|
+
run_validations(args, config_managers)
|
|
372
378
|
|
|
373
379
|
|
|
374
380
|
def build_config_managers_from_yaml(args, config_file_path):
|
|
375
381
|
"""Returns List[ConfigManager] instances ready to be executed."""
|
|
376
|
-
if
|
|
382
|
+
if args.config_dir:
|
|
377
383
|
yaml_configs = cli_tools.get_validation(config_file_path, args.config_dir)
|
|
378
384
|
else:
|
|
379
385
|
yaml_configs = cli_tools.get_validation(config_file_path)
|
|
@@ -616,7 +622,7 @@ def store_json_config_file(args, config_managers):
|
|
|
616
622
|
"""
|
|
617
623
|
json_config = convert_config_to_json(config_managers)
|
|
618
624
|
config_file_path = _get_arg_config_file_json(args)
|
|
619
|
-
cli_tools.
|
|
625
|
+
cli_tools.store_validation(config_file_path, json_config)
|
|
620
626
|
|
|
621
627
|
|
|
622
628
|
def partition_and_store_config_files(args: Namespace) -> None:
|
|
@@ -673,7 +679,7 @@ def run_validation_configs(args):
|
|
|
673
679
|
config_runner(args)
|
|
674
680
|
elif args.validation_config_cmd == "list":
|
|
675
681
|
config_dir = args.config_dir or "./"
|
|
676
|
-
cli_tools.
|
|
682
|
+
cli_tools.print_validations_in_dir(config_dir=config_dir)
|
|
677
683
|
elif args.validation_config_cmd == "get":
|
|
678
684
|
# Get and print yaml file config.
|
|
679
685
|
yaml = cli_tools.get_validation(_get_arg_config_file(args))
|
{google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/cli_tools.py
RENAMED
|
@@ -49,10 +49,12 @@ import json
|
|
|
49
49
|
import logging
|
|
50
50
|
import sys
|
|
51
51
|
import uuid
|
|
52
|
+
import os
|
|
52
53
|
from argparse import Namespace
|
|
53
54
|
from typing import Dict, List
|
|
55
|
+
from yaml import Dumper, Loader, dump, load
|
|
54
56
|
|
|
55
|
-
from data_validation import clients, consts, state_manager
|
|
57
|
+
from data_validation import clients, consts, state_manager, gcs_helper
|
|
56
58
|
|
|
57
59
|
CONNECTION_SOURCE_FIELDS = {
|
|
58
60
|
"BigQuery": [
|
|
@@ -482,6 +484,15 @@ def _configure_row_parser(row_parser):
|
|
|
482
484
|
"-rbs",
|
|
483
485
|
help="Row batch size used for random row filters (default 10,000).",
|
|
484
486
|
)
|
|
487
|
+
optional_arguments.add_argument(
|
|
488
|
+
"--trim-string-pks",
|
|
489
|
+
"-tsp",
|
|
490
|
+
action="store_true",
|
|
491
|
+
help=(
|
|
492
|
+
"Trims string based primary key values, intended for use when one engine uses "
|
|
493
|
+
"padded string semantics (e.g. CHAR(n)) and the other does not (e.g. VARCHAR(n))."
|
|
494
|
+
),
|
|
495
|
+
)
|
|
485
496
|
|
|
486
497
|
# Group required arguments
|
|
487
498
|
required_arguments = row_parser.add_argument_group("required arguments")
|
|
@@ -952,6 +963,18 @@ def _add_common_arguments(optional_arguments, required_arguments):
|
|
|
952
963
|
)
|
|
953
964
|
|
|
954
965
|
|
|
966
|
+
def _check_no_partitions(value: str) -> int:
|
|
967
|
+
"""Check that number of partitions is between [2-10,000]
|
|
968
|
+
Using function to validate rather than choices as error message prints all choices.
|
|
969
|
+
"""
|
|
970
|
+
if value.isdigit() and 2 <= int(value) <= 10000:
|
|
971
|
+
return int(value)
|
|
972
|
+
else:
|
|
973
|
+
raise argparse.ArgumentTypeError(
|
|
974
|
+
f"{value} is not valid for number of partitions, use number in range 2 to 10000"
|
|
975
|
+
)
|
|
976
|
+
|
|
977
|
+
|
|
955
978
|
def _add_common_partition_arguments(optional_arguments, required_arguments):
|
|
956
979
|
"""Add all arguments common to get-partition command"""
|
|
957
980
|
|
|
@@ -976,10 +999,9 @@ def _add_common_partition_arguments(optional_arguments, required_arguments):
|
|
|
976
999
|
"--partition-num",
|
|
977
1000
|
"-pn",
|
|
978
1001
|
required=True,
|
|
979
|
-
help="Number of partitions/config files to generate",
|
|
980
|
-
type=
|
|
981
|
-
|
|
982
|
-
metavar="[1-1000]",
|
|
1002
|
+
help="Number of partitions/config files to generate, a number from 2 to 10,000",
|
|
1003
|
+
type=_check_no_partitions,
|
|
1004
|
+
metavar="[2-10000]",
|
|
983
1005
|
)
|
|
984
1006
|
|
|
985
1007
|
# Optional arguments
|
|
@@ -1081,47 +1103,46 @@ def get_connection(connection_name):
|
|
|
1081
1103
|
return mgr.get_connection_config(connection_name)
|
|
1082
1104
|
|
|
1083
1105
|
|
|
1084
|
-
def store_validation(validation_file_name,
|
|
1085
|
-
"""Store the validation
|
|
1086
|
-
|
|
1087
|
-
mgr.create_validation_yaml(validation_file_name, yaml_config)
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
def store_validation_json(validation_file_name, json_config):
|
|
1091
|
-
"""Store the validation JSON config under the given name."""
|
|
1092
|
-
mgr = state_manager.StateManager()
|
|
1093
|
-
mgr.create_validation_json(validation_file_name, json_config)
|
|
1106
|
+
def store_validation(validation_file_name, config, include_log=True):
|
|
1107
|
+
"""Store the validation config under the given name."""
|
|
1108
|
+
validation_path = gcs_helper.get_validation_path(validation_file_name)
|
|
1094
1109
|
|
|
1110
|
+
if validation_file_name.endswith(".yaml"):
|
|
1111
|
+
config_str = dump(config, Dumper=Dumper)
|
|
1112
|
+
elif validation_file_name.endswith("json"):
|
|
1113
|
+
config_str = json.dumps(config)
|
|
1114
|
+
else:
|
|
1115
|
+
raise ValueError(f"Invalid validation file name: {validation_file_name}")
|
|
1095
1116
|
|
|
1096
|
-
|
|
1097
|
-
"""Store the partition YAML config under the given name."""
|
|
1098
|
-
mgr = state_manager.StateManager(target_folder_path)
|
|
1099
|
-
mgr.create_partition_yaml(target_file_path, yaml_config)
|
|
1117
|
+
gcs_helper.write_file(validation_path, config_str, include_log=include_log)
|
|
1100
1118
|
|
|
1101
1119
|
|
|
1102
|
-
def get_validation(
|
|
1103
|
-
"""Return validation YAML
|
|
1120
|
+
def get_validation(name: str, config_dir: str = None):
|
|
1121
|
+
"""Return validation YAML config."""
|
|
1104
1122
|
if config_dir:
|
|
1105
|
-
|
|
1106
|
-
return mgr.get_validation_config(validation_name, config_dir)
|
|
1123
|
+
validation_path = os.path.join(config_dir, name)
|
|
1107
1124
|
else:
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
return mgr.get_validation_config(
|
|
1113
|
-
validation_name.split("/")[obj_depth - 1], gcs_prefix
|
|
1114
|
-
)
|
|
1115
|
-
else:
|
|
1116
|
-
mgr = state_manager.StateManager()
|
|
1117
|
-
return mgr.get_validation_config(validation_name)
|
|
1125
|
+
validation_path = gcs_helper.get_validation_path(name)
|
|
1126
|
+
|
|
1127
|
+
validation_bytes = gcs_helper.read_file(validation_path)
|
|
1128
|
+
return load(validation_bytes, Loader=Loader)
|
|
1118
1129
|
|
|
1119
1130
|
|
|
1120
1131
|
def list_validations(config_dir="./"):
|
|
1121
|
-
"""List all saved validation YAMLs."""
|
|
1122
|
-
|
|
1123
|
-
|
|
1132
|
+
"""List all saved validation YAMLs in a directory."""
|
|
1133
|
+
logging.info(f"Looking for validations in path {config_dir}")
|
|
1134
|
+
if gcs_helper._is_gcs_path(config_dir):
|
|
1135
|
+
if not config_dir.endswith("/"):
|
|
1136
|
+
config_dir += "/"
|
|
1137
|
+
files = gcs_helper.list_gcs_directory(config_dir)
|
|
1138
|
+
else:
|
|
1139
|
+
files = os.listdir(config_dir)
|
|
1140
|
+
|
|
1141
|
+
return [file_name for file_name in files if file_name.endswith(".yaml")]
|
|
1142
|
+
|
|
1124
1143
|
|
|
1144
|
+
def print_validations_in_dir(config_dir="./"):
|
|
1145
|
+
validations = list_validations(config_dir=config_dir)
|
|
1125
1146
|
logging.info("Validation YAMLs found:")
|
|
1126
1147
|
for validation_name in validations:
|
|
1127
1148
|
logging.info(validation_name)
|
|
@@ -1386,6 +1407,7 @@ def get_pre_build_configs(args: Namespace, validate_cmd: str) -> List[Dict]:
|
|
|
1386
1407
|
"result_handler_config": result_handler_config,
|
|
1387
1408
|
"filter_config": filter_config,
|
|
1388
1409
|
"filter_status": filter_status,
|
|
1410
|
+
"trim_string_pks": getattr(args, "trim_string_pks", False),
|
|
1389
1411
|
"verbose": args.verbose,
|
|
1390
1412
|
}
|
|
1391
1413
|
pre_build_configs_list.append(pre_build_configs)
|
{google-pso-data-validator-4.5.0 → google_pso_data_validator-5.1.0}/data_validation/clients.py
RENAMED
|
@@ -274,6 +274,23 @@ def get_max_column_length(client):
|
|
|
274
274
|
return 128
|
|
275
275
|
|
|
276
276
|
|
|
277
|
+
def get_max_in_list_size(client, in_list_over_expressions=False):
|
|
278
|
+
if client.name == "snowflake":
|
|
279
|
+
if in_list_over_expressions:
|
|
280
|
+
# This is a workaround for Snowflake limitation:
|
|
281
|
+
# SQL compilation error: In-list contains more than 50 non-constant values
|
|
282
|
+
# getattr(..., "cast") expression above is looking for lists where the contents are casts and not simple literals.
|
|
283
|
+
return 50
|
|
284
|
+
else:
|
|
285
|
+
return 16000
|
|
286
|
+
elif is_oracle_client(client):
|
|
287
|
+
# This is a workaround for Oracle limitation:
|
|
288
|
+
# ORA-01795: maximum number of expressions in a list is 1000
|
|
289
|
+
return 1000
|
|
290
|
+
else:
|
|
291
|
+
return None
|
|
292
|
+
|
|
293
|
+
|
|
277
294
|
CLIENT_LOOKUP = {
|
|
278
295
|
"BigQuery": get_bigquery_client,
|
|
279
296
|
"Impala": impala_connect,
|