google-pso-data-validator 7.5.2__tar.gz → 7.6.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-7.5.2 → google_pso_data_validator-7.6.0}/PKG-INFO +64 -26
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/README.md +63 -25
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/__main__.py +6 -26
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/cli_tools.py +65 -33
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/clients.py +12 -12
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/combiner.py +16 -16
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/config_manager.py +12 -46
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/consts.py +29 -7
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/exceptions.py +4 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/partition_builder.py +32 -21
- google_pso_data_validator-7.6.0/data_validation/result_handlers/base_backend.py +85 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/result_handlers/bigquery.py +22 -23
- google_pso_data_validator-7.6.0/data_validation/result_handlers/factory.py +83 -0
- google_pso_data_validator-7.6.0/data_validation/result_handlers/postgres.py +184 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/result_handlers/text.py +3 -3
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/schema_validation.py +23 -19
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/util.py +26 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/PKG-INFO +64 -26
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/SOURCES.txt +3 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/setup.py +1 -1
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_addon/operations.py +13 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_teradata/registry.py +18 -1
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/LICENSE +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/app.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/client_info.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/data_validation.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/find_tables.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/gcs_helper.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/jellyfish_distance.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/metadata.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/query_builder/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/query_builder/partition_row_builder.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/query_builder/query_builder.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/query_builder/random_row_builder.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/raw_query.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/result_handlers/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/secret_manager.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/state_manager.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/validation_builder.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/dependency_links.txt +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/entry_points.txt +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/requires.txt +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/google_pso_data_validator.egg-info/top_level.txt +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/setup.cfg +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_addon/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_addon/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_biquery/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_biquery/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/client.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/registry.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/tests/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/tests/conftest.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_cloud_spanner/to_pandas.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_db2/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_db2/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_db2/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_db2/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_db2/registry.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_impala/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_impala/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mssql/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mssql/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mssql/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mssql/registry.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mysql/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mysql/base_sql_compiler/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mysql/base_sql_compiler/select_builder.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_mysql/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_oracle/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_oracle/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_oracle/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_oracle/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_oracle/registry.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_postgres/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_postgres/client.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_postgres/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_postgres/registry.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_redshift/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_redshift/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_redshift/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_snowflake/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_snowflake/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_snowflake/datatypes.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_teradata/__init__.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_teradata/api.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_teradata/compiler.py +0 -0
- {google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/third_party/ibis/ibis_teradata/datatypes.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: google-pso-data-validator
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.6.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
|
|
@@ -172,9 +172,12 @@ data-validation
|
|
|
172
172
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
173
173
|
[--exclude-columns or -ec]
|
|
174
174
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
175
|
-
[--
|
|
176
|
-
BigQuery destination for validation results.
|
|
175
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
176
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
177
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
177
178
|
See: *Validation Reports* section
|
|
179
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
180
|
+
This option has been deprecated and will be removed in a future release.
|
|
178
181
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
179
182
|
Service account to use for BigQuery result handler output.
|
|
180
183
|
[--wildcard-include-string-len or -wis]
|
|
@@ -256,9 +259,12 @@ data-validation
|
|
|
256
259
|
from the source or target table if available. See *Primary Keys* section
|
|
257
260
|
[--exclude-columns or -ec]
|
|
258
261
|
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
259
|
-
[--
|
|
260
|
-
BigQuery destination for validation results.
|
|
262
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
263
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
264
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
261
265
|
See: *Validation Reports* section
|
|
266
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
267
|
+
This option has been deprecated and will be removed in a future release.
|
|
262
268
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
263
269
|
Service account to use for BigQuery result handler output.
|
|
264
270
|
[--filters SOURCE_FILTER:TARGET_FILTER]
|
|
@@ -337,9 +343,12 @@ data-validation
|
|
|
337
343
|
[--primary-keys PRIMARY_KEYS, -pk PRIMARY_KEYS]
|
|
338
344
|
Comma separated list of primary key columns, when not specified the value will be inferred
|
|
339
345
|
from the source or target table if available. See *Primary Keys* section
|
|
340
|
-
[--
|
|
341
|
-
BigQuery destination for validation results.
|
|
346
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
347
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
348
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
342
349
|
See: *Validation Reports* section
|
|
350
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
351
|
+
This option has been deprecated and will be removed in a future release.
|
|
343
352
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
344
353
|
Service account to use for BigQuery result handler output.
|
|
345
354
|
[--parts-per-file INT], [-ppf INT]
|
|
@@ -383,9 +392,12 @@ data-validation
|
|
|
383
392
|
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
384
393
|
Target schema name and table name are optional.
|
|
385
394
|
e.g.: 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
386
|
-
[--
|
|
387
|
-
BigQuery destination for validation results.
|
|
395
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
396
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
397
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
388
398
|
See: *Validation Reports* section
|
|
399
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
400
|
+
This option has been deprecated and will be removed in a future release.
|
|
389
401
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
390
402
|
Service account to use for BigQuery result handler output.
|
|
391
403
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -443,9 +455,12 @@ data-validation
|
|
|
443
455
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
444
456
|
[--exclude-columns or -ec]
|
|
445
457
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
446
|
-
[--
|
|
447
|
-
BigQuery destination for validation results.
|
|
458
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
459
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
460
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
448
461
|
See: *Validation Reports* section
|
|
462
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
463
|
+
This option has been deprecated and will be removed in a future release.
|
|
449
464
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
450
465
|
Service account to use for BigQuery result handler output.
|
|
451
466
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -512,9 +527,12 @@ data-validation
|
|
|
512
527
|
Common column between source and target queries for join
|
|
513
528
|
[--exclude-columns or -ec]
|
|
514
529
|
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
515
|
-
[--
|
|
516
|
-
BigQuery destination for validation results.
|
|
530
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
531
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
532
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
517
533
|
See: *Validation Reports* section
|
|
534
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
535
|
+
This option has been deprecated and will be removed in a future release.
|
|
518
536
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
519
537
|
Service account to use for BigQuery result handler output.
|
|
520
538
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -624,20 +642,40 @@ The `--config-dir` flag will specify the directory with the YAML files to be exe
|
|
|
624
642
|
|
|
625
643
|
### Validation Reports
|
|
626
644
|
|
|
627
|
-
The result handlers tell DVT where to store the results of
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
645
|
+
The result handlers tell DVT where to store the results of each validation. The
|
|
646
|
+
tool can write the results of a validation run to Google BigQuery, PostgreSQL
|
|
647
|
+
or print to stdout (default). View the schema of the results table [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/terraform/results_schema.json).
|
|
648
|
+
|
|
649
|
+
To output to BigQuery or PostgreSQL, simply include the `-rh` flag during a validation run including
|
|
650
|
+
the schema and table name for the results.
|
|
651
|
+
|
|
652
|
+
BigQuery example by connection name:
|
|
653
|
+
```shell
|
|
654
|
+
data-validation validate column \
|
|
655
|
+
-sc bq_conn \
|
|
656
|
+
-tc bq_conn \
|
|
657
|
+
-tbls bigquery-public-data.new_york_citibike.citibike_trips \
|
|
658
|
+
-rh bq_conn.dataset.results_table \
|
|
659
|
+
-sa 'service-acct@project.iam.gserviceaccount.com'
|
|
660
|
+
```
|
|
631
661
|
|
|
632
|
-
|
|
633
|
-
|
|
662
|
+
BigQuery example by project name:
|
|
663
|
+
```shell
|
|
664
|
+
data-validation validate column \
|
|
665
|
+
-sc bq_conn \
|
|
666
|
+
-tc bq_conn \
|
|
667
|
+
-tbls bigquery-public-data.new_york_citibike.citibike_trips \
|
|
668
|
+
-rh bq-project-id.dataset.results_table \
|
|
669
|
+
-sa 'service-acct@project.iam.gserviceaccount.com'
|
|
634
670
|
```
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
-
|
|
640
|
-
-
|
|
671
|
+
|
|
672
|
+
PostgreSQL example:
|
|
673
|
+
```shell
|
|
674
|
+
data-validation validate column \
|
|
675
|
+
-sc ora_conn \
|
|
676
|
+
-tc pg_conn1 \
|
|
677
|
+
-tbls my_schema.some_table \
|
|
678
|
+
-rh pg_conn2.dvt_schema.results_table
|
|
641
679
|
```
|
|
642
680
|
|
|
643
681
|
### Ad Hoc SQL Exploration
|
|
@@ -670,7 +708,7 @@ target. The `find-tables` command:
|
|
|
670
708
|
|
|
671
709
|
Note that our default value for the `score-cutoff` parameter is 1 and it seeks for identical matches. If no matches occur, reduce this value as deemed necessary. By using smaller numbers such as 0.7, 0.65 etc you can get more matches. For reference, we make use of [this jaro_similarity method](https://jamesturk.github.io/jellyfish/functions/#jaro-similarity) for the string comparison.
|
|
672
710
|
|
|
673
|
-
```
|
|
711
|
+
```shell
|
|
674
712
|
data-validation find-tables --source-conn source --target-conn target \
|
|
675
713
|
--allowed-schemas pso_data_validator \
|
|
676
714
|
--score-cutoff 1
|
|
@@ -113,9 +113,12 @@ data-validation
|
|
|
113
113
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
114
114
|
[--exclude-columns or -ec]
|
|
115
115
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
116
|
-
[--
|
|
117
|
-
BigQuery destination for validation results.
|
|
116
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
117
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
118
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
118
119
|
See: *Validation Reports* section
|
|
120
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
121
|
+
This option has been deprecated and will be removed in a future release.
|
|
119
122
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
120
123
|
Service account to use for BigQuery result handler output.
|
|
121
124
|
[--wildcard-include-string-len or -wis]
|
|
@@ -197,9 +200,12 @@ data-validation
|
|
|
197
200
|
from the source or target table if available. See *Primary Keys* section
|
|
198
201
|
[--exclude-columns or -ec]
|
|
199
202
|
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
200
|
-
[--
|
|
201
|
-
BigQuery destination for validation results.
|
|
203
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
204
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
205
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
202
206
|
See: *Validation Reports* section
|
|
207
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
208
|
+
This option has been deprecated and will be removed in a future release.
|
|
203
209
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
204
210
|
Service account to use for BigQuery result handler output.
|
|
205
211
|
[--filters SOURCE_FILTER:TARGET_FILTER]
|
|
@@ -278,9 +284,12 @@ data-validation
|
|
|
278
284
|
[--primary-keys PRIMARY_KEYS, -pk PRIMARY_KEYS]
|
|
279
285
|
Comma separated list of primary key columns, when not specified the value will be inferred
|
|
280
286
|
from the source or target table if available. See *Primary Keys* section
|
|
281
|
-
[--
|
|
282
|
-
BigQuery destination for validation results.
|
|
287
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
288
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
289
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
283
290
|
See: *Validation Reports* section
|
|
291
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
292
|
+
This option has been deprecated and will be removed in a future release.
|
|
284
293
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
285
294
|
Service account to use for BigQuery result handler output.
|
|
286
295
|
[--parts-per-file INT], [-ppf INT]
|
|
@@ -324,9 +333,12 @@ data-validation
|
|
|
324
333
|
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
325
334
|
Target schema name and table name are optional.
|
|
326
335
|
e.g.: 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
327
|
-
[--
|
|
328
|
-
BigQuery destination for validation results.
|
|
336
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
337
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
338
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
329
339
|
See: *Validation Reports* section
|
|
340
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
341
|
+
This option has been deprecated and will be removed in a future release.
|
|
330
342
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
331
343
|
Service account to use for BigQuery result handler output.
|
|
332
344
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -384,9 +396,12 @@ data-validation
|
|
|
384
396
|
[--std COLUMNS] Comma separated list of columns for stddev_samp or * for all numeric
|
|
385
397
|
[--exclude-columns or -ec]
|
|
386
398
|
Flag to indicate the list of columns provided should be excluded and not included.
|
|
387
|
-
[--
|
|
388
|
-
BigQuery destination for validation results.
|
|
399
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
400
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
401
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
389
402
|
See: *Validation Reports* section
|
|
403
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
404
|
+
This option has been deprecated and will be removed in a future release.
|
|
390
405
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
391
406
|
Service account to use for BigQuery result handler output.
|
|
392
407
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -453,9 +468,12 @@ data-validation
|
|
|
453
468
|
Common column between source and target queries for join
|
|
454
469
|
[--exclude-columns or -ec]
|
|
455
470
|
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
456
|
-
[--
|
|
457
|
-
BigQuery destination for validation results.
|
|
471
|
+
[--result-handler or -rh CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE]
|
|
472
|
+
Specify a BigQuery or PostgreSQL connection name as destination for validation results.
|
|
473
|
+
Also supports legacy BigQuery format BQ_PROJECT_ID.DATASET.TABLE.
|
|
458
474
|
See: *Validation Reports* section
|
|
475
|
+
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE or CONNECTION_NAME.DATASET.TABLE]
|
|
476
|
+
This option has been deprecated and will be removed in a future release.
|
|
459
477
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
460
478
|
Service account to use for BigQuery result handler output.
|
|
461
479
|
[--config-file or -c CONFIG_FILE]
|
|
@@ -565,20 +583,40 @@ The `--config-dir` flag will specify the directory with the YAML files to be exe
|
|
|
565
583
|
|
|
566
584
|
### Validation Reports
|
|
567
585
|
|
|
568
|
-
The result handlers tell DVT where to store the results of
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
586
|
+
The result handlers tell DVT where to store the results of each validation. The
|
|
587
|
+
tool can write the results of a validation run to Google BigQuery, PostgreSQL
|
|
588
|
+
or print to stdout (default). View the schema of the results table [here](https://github.com/GoogleCloudPlatform/professional-services-data-validator/blob/develop/terraform/results_schema.json).
|
|
589
|
+
|
|
590
|
+
To output to BigQuery or PostgreSQL, simply include the `-rh` flag during a validation run including
|
|
591
|
+
the schema and table name for the results.
|
|
592
|
+
|
|
593
|
+
BigQuery example by connection name:
|
|
594
|
+
```shell
|
|
595
|
+
data-validation validate column \
|
|
596
|
+
-sc bq_conn \
|
|
597
|
+
-tc bq_conn \
|
|
598
|
+
-tbls bigquery-public-data.new_york_citibike.citibike_trips \
|
|
599
|
+
-rh bq_conn.dataset.results_table \
|
|
600
|
+
-sa 'service-acct@project.iam.gserviceaccount.com'
|
|
601
|
+
```
|
|
572
602
|
|
|
573
|
-
|
|
574
|
-
|
|
603
|
+
BigQuery example by project name:
|
|
604
|
+
```shell
|
|
605
|
+
data-validation validate column \
|
|
606
|
+
-sc bq_conn \
|
|
607
|
+
-tc bq_conn \
|
|
608
|
+
-tbls bigquery-public-data.new_york_citibike.citibike_trips \
|
|
609
|
+
-rh bq-project-id.dataset.results_table \
|
|
610
|
+
-sa 'service-acct@project.iam.gserviceaccount.com'
|
|
575
611
|
```
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
-
|
|
581
|
-
-
|
|
612
|
+
|
|
613
|
+
PostgreSQL example:
|
|
614
|
+
```shell
|
|
615
|
+
data-validation validate column \
|
|
616
|
+
-sc ora_conn \
|
|
617
|
+
-tc pg_conn1 \
|
|
618
|
+
-tbls my_schema.some_table \
|
|
619
|
+
-rh pg_conn2.dvt_schema.results_table
|
|
582
620
|
```
|
|
583
621
|
|
|
584
622
|
### Ad Hoc SQL Exploration
|
|
@@ -611,7 +649,7 @@ target. The `find-tables` command:
|
|
|
611
649
|
|
|
612
650
|
Note that our default value for the `score-cutoff` parameter is 1 and it seeks for identical matches. If no matches occur, reduce this value as deemed necessary. By using smaller numbers such as 0.7, 0.65 etc you can get more matches. For reference, we make use of [this jaro_similarity method](https://jamesturk.github.io/jellyfish/functions/#jaro-similarity) for the string comparison.
|
|
613
651
|
|
|
614
|
-
```
|
|
652
|
+
```shell
|
|
615
653
|
data-validation find-tables --source-conn source --target-conn target \
|
|
616
654
|
--allowed-schemas pso_data_validator \
|
|
617
655
|
--score-cutoff 1
|
{google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/__main__.py
RENAMED
|
@@ -530,35 +530,15 @@ def run_validation(config_manager: ConfigManager, dry_run=False, verbose=False):
|
|
|
530
530
|
) as validator:
|
|
531
531
|
|
|
532
532
|
if dry_run:
|
|
533
|
-
sql_alchemy_clients = [
|
|
534
|
-
"mysql",
|
|
535
|
-
"oracle",
|
|
536
|
-
"postgres",
|
|
537
|
-
"db2",
|
|
538
|
-
"mssql",
|
|
539
|
-
"redshift",
|
|
540
|
-
"snowflake",
|
|
541
|
-
]
|
|
542
|
-
|
|
543
|
-
source_query = validator.validation_builder.get_source_query().compile()
|
|
544
|
-
if config_manager.source_client.name in sql_alchemy_clients:
|
|
545
|
-
source_query = source_query.compile(
|
|
546
|
-
config_manager.source_client.con.engine,
|
|
547
|
-
compile_kwargs={"literal_binds": True},
|
|
548
|
-
)
|
|
549
|
-
|
|
550
|
-
target_query = validator.validation_builder.get_target_query().compile()
|
|
551
|
-
if config_manager.target_client.name in sql_alchemy_clients:
|
|
552
|
-
target_query = target_query.compile(
|
|
553
|
-
config_manager.target_client.con.engine,
|
|
554
|
-
compile_kwargs={"literal_binds": True},
|
|
555
|
-
)
|
|
556
|
-
|
|
557
533
|
print(
|
|
558
534
|
json.dumps(
|
|
559
535
|
{
|
|
560
|
-
"source_query":
|
|
561
|
-
|
|
536
|
+
"source_query": util.ibis_table_to_sql(
|
|
537
|
+
validator.validation_builder.get_source_query()
|
|
538
|
+
),
|
|
539
|
+
"target_query": util.ibis_table_to_sql(
|
|
540
|
+
validator.validation_builder.get_target_query()
|
|
541
|
+
),
|
|
562
542
|
},
|
|
563
543
|
indent=4,
|
|
564
544
|
)
|
{google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/cli_tools.py
RENAMED
|
@@ -20,7 +20,7 @@ The Data Validator can be called either using:
|
|
|
20
20
|
|
|
21
21
|
ex.
|
|
22
22
|
Step 1) Store Connection to be used in validation
|
|
23
|
-
data-validation connections add -c my_bq_conn BigQuery --project-id pso-
|
|
23
|
+
data-validation connections add -c my_bq_conn BigQuery --project-id pso-project
|
|
24
24
|
|
|
25
25
|
Step 2) Run Validation using supplied connections
|
|
26
26
|
data-validation validate column -sc my_bq_conn -tc my_bq_conn \
|
|
@@ -36,7 +36,7 @@ data-validation validate column \
|
|
|
36
36
|
-sc my_bq_conn -tc my_bq_conn \
|
|
37
37
|
-tbls bigquery-public-data.new_york_citibike.citibike_trips,bigquery-public-data.new_york_citibike.citibike_stations \
|
|
38
38
|
--sum tripduration,start_station_name --count tripduration,start_station_name \
|
|
39
|
-
-
|
|
39
|
+
-rh pso-project.pso_data_validator.results \
|
|
40
40
|
-c ex_yaml.yaml
|
|
41
41
|
|
|
42
42
|
command:
|
|
@@ -58,6 +58,7 @@ from yaml import Dumper, Loader, dump, load
|
|
|
58
58
|
from data_validation import (
|
|
59
59
|
clients,
|
|
60
60
|
consts,
|
|
61
|
+
exceptions,
|
|
61
62
|
find_tables,
|
|
62
63
|
state_manager,
|
|
63
64
|
gcs_helper,
|
|
@@ -70,7 +71,7 @@ if TYPE_CHECKING:
|
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
CONNECTION_SOURCE_FIELDS = {
|
|
73
|
-
|
|
74
|
+
consts.SOURCE_TYPE_BIGQUERY: [
|
|
74
75
|
["project_id", "GCP Project to use for BigQuery"],
|
|
75
76
|
["google_service_account_key_path", "(Optional) GCP SA Key Path"],
|
|
76
77
|
[
|
|
@@ -78,7 +79,7 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
78
79
|
'(Optional) GCP BigQuery API endpoint (e.g. "https://mybq.p.googleapis.com")',
|
|
79
80
|
],
|
|
80
81
|
],
|
|
81
|
-
|
|
82
|
+
consts.SOURCE_TYPE_TERADATA: [
|
|
82
83
|
["host", "Desired Teradata host"],
|
|
83
84
|
["port", "Teradata port to connect on"],
|
|
84
85
|
["user_name", "User used to connect"],
|
|
@@ -87,7 +88,7 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
87
88
|
["use_no_lock_tables", "Use an access lock for queries (defaults to False)"],
|
|
88
89
|
["json_params", "(Optional) Additional teradatasql JSON string parameters"],
|
|
89
90
|
],
|
|
90
|
-
|
|
91
|
+
consts.SOURCE_TYPE_ORACLE: [
|
|
91
92
|
["host", "Desired Oracle host"],
|
|
92
93
|
["port", "Oracle port to connect on"],
|
|
93
94
|
["user", "User used to connect"],
|
|
@@ -95,7 +96,7 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
95
96
|
["database", "Database to connect to"],
|
|
96
97
|
["url", "Oracle SQLAlchemy connection URL"],
|
|
97
98
|
],
|
|
98
|
-
|
|
99
|
+
consts.SOURCE_TYPE_MSSQL: [
|
|
99
100
|
["host", "Desired SQL Server host (default localhost)"],
|
|
100
101
|
["port", "SQL Server port to connect on (default 1433)"],
|
|
101
102
|
["user", "User used to connect"],
|
|
@@ -104,35 +105,35 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
104
105
|
["query", "Connection query parameters"],
|
|
105
106
|
["url", "SQL Server SQLAlchemy connection URL"],
|
|
106
107
|
],
|
|
107
|
-
|
|
108
|
+
consts.SOURCE_TYPE_MYSQL: [
|
|
108
109
|
["host", "Desired MySQL host (default localhost)"],
|
|
109
110
|
["port", "MySQL port to connect on (default 3306)"],
|
|
110
111
|
["user", "User used to connect"],
|
|
111
112
|
["password", "Password for supplied user"],
|
|
112
113
|
["database", "Database to connect to (default master)"],
|
|
113
114
|
],
|
|
114
|
-
|
|
115
|
+
consts.SOURCE_TYPE_SNOWFLAKE: [
|
|
115
116
|
["user", "Username to connect to"],
|
|
116
117
|
["password", "Password for authentication of user"],
|
|
117
118
|
["account", "Snowflake account to connect to"],
|
|
118
119
|
["database", "Database in snowflake to connect to"],
|
|
119
120
|
["connect_args", "(Optional) Additional connection arg mapping"],
|
|
120
121
|
],
|
|
121
|
-
|
|
122
|
+
consts.SOURCE_TYPE_POSTGRES: [
|
|
122
123
|
["host", "Desired PostgreSQL host."],
|
|
123
124
|
["port", "PostgreSQL port to connect on (e.g. 5432)"],
|
|
124
125
|
["user", "Username to connect to"],
|
|
125
126
|
["password", "Password for authentication of user"],
|
|
126
127
|
["database", "Database in PostgreSQL to connect to (default postgres)"],
|
|
127
128
|
],
|
|
128
|
-
|
|
129
|
+
consts.SOURCE_TYPE_REDSHIFT: [
|
|
129
130
|
["host", "Desired Redshift host."],
|
|
130
131
|
["port", "Redshift port to connect on (e.g. 5439)"],
|
|
131
132
|
["user", "Username to connect to"],
|
|
132
133
|
["password", "Password for authentication of user"],
|
|
133
134
|
["database", "Database in Redshift to connect to"],
|
|
134
135
|
],
|
|
135
|
-
|
|
136
|
+
consts.SOURCE_TYPE_SPANNER: [
|
|
136
137
|
["project_id", "GCP Project to use for Spanner"],
|
|
137
138
|
["instance_id", "ID of Spanner instance to connect to"],
|
|
138
139
|
["database_id", "ID of Spanner database (schema) to connect to"],
|
|
@@ -142,12 +143,12 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
142
143
|
'(Optional) GCP Spanner API endpoint (e.g. "https://mycs.p.googleapis.com")',
|
|
143
144
|
],
|
|
144
145
|
],
|
|
145
|
-
|
|
146
|
+
consts.SOURCE_TYPE_FILESYSTEM: [
|
|
146
147
|
["table_name", "Table name to use as reference for file data"],
|
|
147
148
|
["file_path", "The local, s3, or GCS file path to the data"],
|
|
148
149
|
["file_type", "The file type of the file. 'csv', 'orc', 'parquet' or 'json'"],
|
|
149
150
|
],
|
|
150
|
-
|
|
151
|
+
consts.SOURCE_TYPE_IMPALA: [
|
|
151
152
|
["host", "Desired Impala host"],
|
|
152
153
|
["port", "Desired Impala port (10000 if not provided)"],
|
|
153
154
|
["database", "Desired Impala database (default if not provided)"],
|
|
@@ -175,7 +176,7 @@ CONNECTION_SOURCE_FIELDS = {
|
|
|
175
176
|
["use_http_transport", "Boolean if HTTP proxy is provided (default is False)"],
|
|
176
177
|
["http_path", "URL path of HTTP proxy"],
|
|
177
178
|
],
|
|
178
|
-
|
|
179
|
+
consts.SOURCE_TYPE_DB2: [
|
|
179
180
|
["host", "Desired DB2 host"],
|
|
180
181
|
["port", "Desired DB2 port (50000 if not provided)"],
|
|
181
182
|
["user", "Username to connect to"],
|
|
@@ -297,7 +298,7 @@ def _configure_partition_parser(subparsers):
|
|
|
297
298
|
"-pn",
|
|
298
299
|
required=True,
|
|
299
300
|
help="Number of partitions into which the table should be split",
|
|
300
|
-
type=
|
|
301
|
+
type=_check_gt_one,
|
|
301
302
|
)
|
|
302
303
|
# User can provide tables or custom queries, but not both
|
|
303
304
|
# However, Argparse does not support adding an argument_group to an argument_group or adding a
|
|
@@ -1012,7 +1013,15 @@ def _add_common_arguments(
|
|
|
1012
1013
|
|
|
1013
1014
|
# Optional arguments
|
|
1014
1015
|
optional_arguments.add_argument(
|
|
1015
|
-
"--bq-result-handler", "-bqrh", help=
|
|
1016
|
+
"--bq-result-handler", "-bqrh", help=argparse.SUPPRESS
|
|
1017
|
+
)
|
|
1018
|
+
optional_arguments.add_argument(
|
|
1019
|
+
"--result-handler",
|
|
1020
|
+
"-rh",
|
|
1021
|
+
help=(
|
|
1022
|
+
"Result handler connection details. "
|
|
1023
|
+
"CONNECTION_NAME.SCHEMA.TABLE or BQ_PROJECT_ID.DATASET.TABLE."
|
|
1024
|
+
),
|
|
1016
1025
|
)
|
|
1017
1026
|
optional_arguments.add_argument(
|
|
1018
1027
|
"--labels", "-l", help="Key value pair labels for validation run"
|
|
@@ -1055,13 +1064,22 @@ def _add_common_arguments(
|
|
|
1055
1064
|
)
|
|
1056
1065
|
|
|
1057
1066
|
|
|
1058
|
-
def _check_positive(value: int) -> int:
|
|
1067
|
+
def _check_positive(value: int, lower_bound: int = 1) -> int:
|
|
1059
1068
|
ivalue = int(value)
|
|
1060
|
-
if ivalue
|
|
1061
|
-
|
|
1069
|
+
if ivalue < lower_bound:
|
|
1070
|
+
if lower_bound == 1:
|
|
1071
|
+
raise argparse.ArgumentTypeError(
|
|
1072
|
+
f"{value} is an invalid positive int value"
|
|
1073
|
+
)
|
|
1074
|
+
else:
|
|
1075
|
+
raise argparse.ArgumentTypeError(f"Value must be >= {lower_bound}: {value}")
|
|
1062
1076
|
return ivalue
|
|
1063
1077
|
|
|
1064
1078
|
|
|
1079
|
+
def _check_gt_one(value: int) -> int:
|
|
1080
|
+
return _check_positive(value, lower_bound=2)
|
|
1081
|
+
|
|
1082
|
+
|
|
1065
1083
|
def check_no_yaml_files(partition_num: int, parts_per_file: int):
|
|
1066
1084
|
"""Check that number of yaml files generated is less than 10,001
|
|
1067
1085
|
Will be invoked after all the arguments are processed."""
|
|
@@ -1244,7 +1262,7 @@ def get_filters(filter_value: str) -> List[Dict]:
|
|
|
1244
1262
|
return filter_config
|
|
1245
1263
|
|
|
1246
1264
|
|
|
1247
|
-
def
|
|
1265
|
+
def _get_result_handler(rc_value: str, sa_file=None) -> dict:
|
|
1248
1266
|
"""Returns dict of result handler config. Backwards compatible for JSON input.
|
|
1249
1267
|
|
|
1250
1268
|
rc_value (str): Result config argument specified.
|
|
@@ -1254,22 +1272,34 @@ def get_result_handler(rc_value: str, sa_file=None) -> dict:
|
|
|
1254
1272
|
if len(config) != 2:
|
|
1255
1273
|
raise ValueError(f"Unable to parse result handler config: `{rc_value}`")
|
|
1256
1274
|
|
|
1257
|
-
# Check if the first part of the
|
|
1275
|
+
# Check if the first part of the result handler is a connection name.
|
|
1258
1276
|
mgr = state_manager.StateManager()
|
|
1259
1277
|
connections = mgr.list_connections()
|
|
1260
1278
|
if config[0] in connections:
|
|
1261
|
-
# We received connection_name.
|
|
1279
|
+
# We received connection_name.results_table.
|
|
1262
1280
|
conn_from_file = get_connection(config[0])
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1281
|
+
if conn_from_file[consts.SOURCE_TYPE] == consts.SOURCE_TYPE_BIGQUERY:
|
|
1282
|
+
result_handler = {
|
|
1283
|
+
consts.RH_TYPE: conn_from_file[consts.SOURCE_TYPE],
|
|
1284
|
+
consts.PROJECT_ID: conn_from_file["project_id"],
|
|
1285
|
+
consts.TABLE_ID: config[1],
|
|
1286
|
+
consts.API_ENDPOINT: conn_from_file.get("api_endpoint", None),
|
|
1287
|
+
}
|
|
1288
|
+
elif conn_from_file[consts.SOURCE_TYPE] == consts.SOURCE_TYPE_POSTGRES:
|
|
1289
|
+
result_handler = {
|
|
1290
|
+
consts.RH_TYPE: conn_from_file[consts.SOURCE_TYPE],
|
|
1291
|
+
consts.TABLE_ID: config[1],
|
|
1292
|
+
consts.RH_CONN: conn_from_file,
|
|
1293
|
+
}
|
|
1294
|
+
# TODO Add filesytem handler too.
|
|
1295
|
+
else:
|
|
1296
|
+
raise exceptions.ResultHandlerException(
|
|
1297
|
+
f"Unsupported result handler connection type: {conn_from_file[consts.SOURCE_TYPE]}"
|
|
1298
|
+
)
|
|
1269
1299
|
else:
|
|
1270
|
-
# We received
|
|
1300
|
+
# We received legacy format "bq-project-name.bq_results_table".
|
|
1271
1301
|
result_handler = {
|
|
1272
|
-
|
|
1302
|
+
consts.RH_TYPE: consts.SOURCE_TYPE_BIGQUERY,
|
|
1273
1303
|
consts.PROJECT_ID: config[0],
|
|
1274
1304
|
consts.TABLE_ID: config[1],
|
|
1275
1305
|
}
|
|
@@ -1489,10 +1519,12 @@ def get_pre_build_configs(args: "Namespace", validate_cmd: str) -> List[Dict]:
|
|
|
1489
1519
|
else:
|
|
1490
1520
|
raise ValueError(f"Unknown Validation Type: {validate_cmd}")
|
|
1491
1521
|
|
|
1522
|
+
# Cater for legacy -bqrh.
|
|
1523
|
+
args.result_handler = args.result_handler or args.bq_result_handler
|
|
1492
1524
|
# Get result handler config
|
|
1493
|
-
if args.
|
|
1494
|
-
result_handler_config =
|
|
1495
|
-
args.
|
|
1525
|
+
if args.result_handler:
|
|
1526
|
+
result_handler_config = _get_result_handler(
|
|
1527
|
+
args.result_handler, args.service_account
|
|
1496
1528
|
)
|
|
1497
1529
|
else:
|
|
1498
1530
|
result_handler_config = None
|
{google_pso_data_validator-7.5.2 → google_pso_data_validator-7.6.0}/data_validation/clients.py
RENAMED
|
@@ -369,16 +369,16 @@ def get_max_in_list_size(client, in_list_over_expressions=False):
|
|
|
369
369
|
|
|
370
370
|
|
|
371
371
|
CLIENT_LOOKUP = {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
372
|
+
consts.SOURCE_TYPE_BIGQUERY: get_bigquery_client,
|
|
373
|
+
consts.SOURCE_TYPE_IMPALA: impala_connect,
|
|
374
|
+
consts.SOURCE_TYPE_MYSQL: ibis.mysql.connect,
|
|
375
|
+
consts.SOURCE_TYPE_ORACLE: oracle_connect,
|
|
376
|
+
consts.SOURCE_TYPE_FILESYSTEM: get_pandas_client,
|
|
377
|
+
consts.SOURCE_TYPE_POSTGRES: ibis.postgres.connect,
|
|
378
|
+
consts.SOURCE_TYPE_REDSHIFT: redshift_connect,
|
|
379
|
+
consts.SOURCE_TYPE_TERADATA: teradata_connect,
|
|
380
|
+
consts.SOURCE_TYPE_MSSQL: mssql_connect,
|
|
381
|
+
consts.SOURCE_TYPE_SNOWFLAKE: snowflake_connect,
|
|
382
|
+
consts.SOURCE_TYPE_SPANNER: spanner_connect,
|
|
383
|
+
consts.SOURCE_TYPE_DB2: db2_connect,
|
|
384
384
|
}
|