google-pso-data-validator 6.0.0__tar.gz → 6.2.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-6.0.0 → google_pso_data_validator-6.2.0}/PKG-INFO +76 -37
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/README.md +57 -13
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/__main__.py +41 -88
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/cli_tools.py +177 -18
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/clients.py +30 -11
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/config_manager.py +57 -75
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/consts.py +14 -0
- google_pso_data_validator-6.2.0/data_validation/find_tables.py +148 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/partition_builder.py +54 -33
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/query_builder/partition_row_builder.py +1 -1
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/result_handlers/bigquery.py +36 -14
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/result_handlers/text.py +27 -13
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/google_pso_data_validator.egg-info/PKG-INFO +76 -37
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/google_pso_data_validator.egg-info/SOURCES.txt +2 -0
- google_pso_data_validator-6.2.0/google_pso_data_validator.egg-info/requires.txt +26 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/setup.py +21 -28
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_addon/operations.py +23 -6
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_db2/registry.py +1 -1
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_impala/api.py +26 -3
- google_pso_data_validator-6.2.0/third_party/ibis/ibis_mssql/registry.py +49 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_oracle/__init__.py +45 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_oracle/datatypes.py +6 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_teradata/datatypes.py +10 -2
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_teradata/registry.py +24 -9
- google_pso_data_validator-6.0.0/google_pso_data_validator.egg-info/requires.txt +0 -31
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/LICENSE +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/app.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/client_info.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/combiner.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/data_validation.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/exceptions.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/gcs_helper.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/jellyfish_distance.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/metadata.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/query_builder/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/query_builder/query_builder.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/query_builder/random_row_builder.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/result_handlers/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/schema_validation.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/secret_manager.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/state_manager.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/validation_builder.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/google_pso_data_validator.egg-info/dependency_links.txt +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/google_pso_data_validator.egg-info/entry_points.txt +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/google_pso_data_validator.egg-info/top_level.txt +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/setup.cfg +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_addon/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_addon/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/client.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/compiler.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/datatypes.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/registry.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/tests/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/tests/conftest.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_cloud_spanner/to_pandas.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_db2/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_db2/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_db2/compiler.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_db2/datatypes.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_impala/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mssql/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mssql/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mssql/datatypes.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mysql/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mysql/base_sql_compiler/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mysql/base_sql_compiler/select_builder.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_mysql/compiler.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_oracle/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_oracle/compiler.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_oracle/registry.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_postgres/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_postgres/client.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_postgres/datatypes.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_redshift/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_redshift/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_redshift/compiler.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_snowflake/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_snowflake/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_snowflake/datatypes.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_teradata/__init__.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_teradata/api.py +0 -0
- {google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/third_party/ibis/ibis_teradata/compiler.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: google-pso-data-validator
|
|
3
|
-
Version: 6.
|
|
3
|
+
Version: 6.2.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
|
|
@@ -14,31 +14,26 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Requires-Python: >=3.8
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist: google-
|
|
17
|
+
Requires-Dist: Flask>=2.2
|
|
18
|
+
Requires-Dist: fsspec>=2024.9.0
|
|
19
|
+
Requires-Dist: google-api-python-client>=2.144.0
|
|
20
|
+
Requires-Dist: google-cloud-bigquery>=3.25.0
|
|
21
|
+
Requires-Dist: google-cloud-bigquery-storage>=2.26.0
|
|
22
|
+
Requires-Dist: google-cloud-secret-manager>=2.20.2
|
|
23
|
+
Requires-Dist: google-cloud-spanner>=3.49.1
|
|
24
|
+
Requires-Dist: google-cloud-storage>=2.18.2
|
|
23
25
|
Requires-Dist: ibis-framework==5.1.0
|
|
24
|
-
Requires-Dist: impyla
|
|
25
|
-
Requires-Dist:
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist: pandas==1.5.3
|
|
30
|
-
Requires-Dist: proto-plus==1.22.3
|
|
26
|
+
Requires-Dist: impyla>=0.19.0
|
|
27
|
+
Requires-Dist: jellyfish>=1.1.0
|
|
28
|
+
Requires-Dist: pandas==2.0.3
|
|
29
|
+
Requires-Dist: parsy>=2.1
|
|
30
|
+
Requires-Dist: psycopg2-binary>=2.9.9
|
|
31
31
|
Requires-Dist: pyarrow==14.0.1
|
|
32
|
-
Requires-Dist: pydata-google-auth
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
36
|
-
Requires-Dist:
|
|
37
|
-
Requires-Dist: jellyfish==1.0.0
|
|
38
|
-
Requires-Dist: tabulate==0.9.0
|
|
39
|
-
Requires-Dist: Flask==2.3.2
|
|
40
|
-
Requires-Dist: parsy==2.1
|
|
41
|
-
Requires-Dist: google-cloud-secret-manager>=2.16.0
|
|
32
|
+
Requires-Dist: pydata-google-auth>=1.8.2
|
|
33
|
+
Requires-Dist: PyMySQL>=1.1.1
|
|
34
|
+
Requires-Dist: PyYAML>=6.0.2
|
|
35
|
+
Requires-Dist: SQLAlchemy==1.4.49
|
|
36
|
+
Requires-Dist: tabulate>=0.9.0
|
|
42
37
|
Provides-Extra: apache-airflow
|
|
43
38
|
Requires-Dist: 1.10.11; extra == "apache-airflow"
|
|
44
39
|
Provides-Extra: pyspark
|
|
@@ -133,7 +128,12 @@ over all columns ('*') will only run over numeric columns, unless the
|
|
|
133
128
|
`--wildcard-include-string-len` or `--wildcard-include-timestamp` flags are present.
|
|
134
129
|
|
|
135
130
|
```
|
|
136
|
-
data-validation
|
|
131
|
+
data-validation
|
|
132
|
+
[--verbose or -v ]
|
|
133
|
+
Verbose logging
|
|
134
|
+
[--log-level or -ll]
|
|
135
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
136
|
+
validate column
|
|
137
137
|
--source-conn or -sc SOURCE_CONN
|
|
138
138
|
Source connection details
|
|
139
139
|
See: *Data Source Configurations* section for each data source
|
|
@@ -141,7 +141,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
141
141
|
Target connection details
|
|
142
142
|
See: *Connections* section for each data source
|
|
143
143
|
--tables-list or -tbls SOURCE_SCHEMA.SOURCE_TABLE=TARGET_SCHEMA.TARGET_TABLE
|
|
144
|
-
Comma separated list of tables in the form schema.table=target_schema.target_table
|
|
144
|
+
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
145
145
|
Target schema name and table name are optional.
|
|
146
146
|
i.e 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
147
147
|
[--grouped-columns or -gc GROUPED_COLUMNS]
|
|
@@ -182,6 +182,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
182
182
|
Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
|
|
183
183
|
[--filter-status or -fs STATUSES_LIST]
|
|
184
184
|
Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
|
|
185
|
+
|
|
185
186
|
```
|
|
186
187
|
|
|
187
188
|
The default aggregation type is a 'COUNT *', which will run in addition to the validations you specify. To remove this default,
|
|
@@ -212,7 +213,12 @@ Under the hood, row validation uses
|
|
|
212
213
|
apply functions such as IFNULL() or RTRIM(). These can be edited in the YAML or JSON config file to customize your row validation.
|
|
213
214
|
|
|
214
215
|
```
|
|
215
|
-
data-validation
|
|
216
|
+
data-validation
|
|
217
|
+
[--verbose or -v ]
|
|
218
|
+
Verbose logging
|
|
219
|
+
[--log-level or -ll]
|
|
220
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
221
|
+
validate row
|
|
216
222
|
--source-conn or -sc SOURCE_CONN
|
|
217
223
|
Source connection details
|
|
218
224
|
See: *Data Source Configurations* section for each data source
|
|
@@ -230,6 +236,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
230
236
|
See: *Calculated Fields* section for details
|
|
231
237
|
--hash COLUMNS Comma separated list of columns to hash or * for all columns
|
|
232
238
|
--concat COLUMNS Comma separated list of columns to concatenate or * for all columns (use if a common hash function is not available between databases)
|
|
239
|
+
[--exclude-columns or -ec]
|
|
240
|
+
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
233
241
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
234
242
|
BigQuery destination for validation results. Defaults to stdout.
|
|
235
243
|
See: *Validation Reports* section
|
|
@@ -268,8 +276,12 @@ The command generates and stores multiple YAML validations each representing a c
|
|
|
268
276
|
The command takes the same parameters as required for `Row Validation` *plus* a few parameters to support partitioning. Single and multiple primary keys are supported and keys can be of any indexable type, except for date and timestamp type. A parameter used in earlier versions, ```partition-key``` is no longer supported.
|
|
269
277
|
|
|
270
278
|
```
|
|
271
|
-
data-validation
|
|
272
|
-
|
|
279
|
+
data-validation
|
|
280
|
+
[--verbose or -v ]
|
|
281
|
+
Verbose logging
|
|
282
|
+
[--log-level or -ll]
|
|
283
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
284
|
+
generate-table-partitions
|
|
273
285
|
--source-conn or -sc SOURCE_CONN
|
|
274
286
|
Source connection details
|
|
275
287
|
See: *Data Source Configurations* section for each data source
|
|
@@ -291,7 +303,7 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
|
|
|
291
303
|
Directory Path to store YAML Config Files
|
|
292
304
|
GCS: Provide a full gs:// path of the target directory. Eg: `gs://<BUCKET>/partitions_dir`
|
|
293
305
|
Local: Provide a relative path of the target directory. Eg: `partitions_dir`
|
|
294
|
-
--partition-num INT, -pn INT
|
|
306
|
+
--partition-num INT, -pn INT
|
|
295
307
|
Number of partitions into which the table should be split, e.g. 1000 or 10000
|
|
296
308
|
In case this value exceeds the row count of the source/target table, it will be decreased to max(source_row_count, target_row_count)
|
|
297
309
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
@@ -299,7 +311,7 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
|
|
|
299
311
|
See: *Validation Reports* section
|
|
300
312
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
301
313
|
Service account to use for BigQuery result handler output.
|
|
302
|
-
[--parts-per-file INT], [-ppf INT]
|
|
314
|
+
[--parts-per-file INT], [-ppf INT]
|
|
303
315
|
Number of partitions in a yaml file, default value 1.
|
|
304
316
|
[--filters SOURCE_FILTER:TARGET_FILTER]
|
|
305
317
|
Colon separated string values of source and target filters.
|
|
@@ -324,7 +336,12 @@ types between source and target.
|
|
|
324
336
|
Note: An exclamation point before a data type (`!string`) signifies the column is non-nullable or required.
|
|
325
337
|
|
|
326
338
|
```
|
|
327
|
-
data-validation
|
|
339
|
+
data-validation
|
|
340
|
+
[--verbose or -v ]
|
|
341
|
+
Verbose logging
|
|
342
|
+
[--log-level or -ll]
|
|
343
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
344
|
+
validate schema
|
|
328
345
|
--source-conn or -sc SOURCE_CONN
|
|
329
346
|
Source connection details
|
|
330
347
|
See: *Data Source Configurations* section for each data source
|
|
@@ -332,7 +349,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
332
349
|
Target connection details
|
|
333
350
|
See: *Connections* section for each data source
|
|
334
351
|
--tables-list or -tbls SOURCE_SCHEMA.SOURCE_TABLE=TARGET_SCHEMA.TARGET_TABLE
|
|
335
|
-
Comma separated list of tables in the form schema.table=target_schema.target_table
|
|
352
|
+
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
336
353
|
Target schema name and table name are optional.
|
|
337
354
|
e.g.: 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
338
355
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
@@ -365,7 +382,12 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
365
382
|
Below is the command syntax for custom query column validations.
|
|
366
383
|
|
|
367
384
|
```
|
|
368
|
-
data-validation
|
|
385
|
+
data-validation
|
|
386
|
+
[--verbose or -v ]
|
|
387
|
+
Verbose logging
|
|
388
|
+
[--log-level or -ll]
|
|
389
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
390
|
+
validate custom-query column
|
|
369
391
|
--source-conn or -sc SOURCE_CONN
|
|
370
392
|
Source connection details
|
|
371
393
|
See: *Data Source Configurations* section for each data source
|
|
@@ -427,7 +449,12 @@ in the SELECT statement of both source_query.sql and target_query.sql. See *Pri
|
|
|
427
449
|
Below is the command syntax for custom query row validations.
|
|
428
450
|
|
|
429
451
|
```
|
|
430
|
-
data-validation
|
|
452
|
+
data-validation
|
|
453
|
+
[--verbose or -v ]
|
|
454
|
+
Verbose logging
|
|
455
|
+
[--log-level or -ll]
|
|
456
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
457
|
+
validate custom-query row
|
|
431
458
|
--source-conn or -sc SOURCE_CONN
|
|
432
459
|
Source connection details
|
|
433
460
|
See: *Data Source Configurations* section for each data source
|
|
@@ -452,6 +479,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
452
479
|
(use if a common hash function is not available between databases)
|
|
453
480
|
--primary-key or -pk JOIN_KEY
|
|
454
481
|
Common column between source and target tables for join
|
|
482
|
+
[--exclude-columns or -ec]
|
|
483
|
+
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
455
484
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
456
485
|
BigQuery destination for validation results. Defaults to stdout.
|
|
457
486
|
See: *Validation Reports* section
|
|
@@ -483,7 +512,12 @@ The `validate` command takes a `--dry-run` command line flag that prints source
|
|
|
483
512
|
and target SQL to stdout as JSON in lieu of performing a validation:
|
|
484
513
|
|
|
485
514
|
```
|
|
486
|
-
data-validation
|
|
515
|
+
data-validation
|
|
516
|
+
[--verbose or -v ]
|
|
517
|
+
Verbose logging
|
|
518
|
+
[--log-level or -ll]
|
|
519
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
520
|
+
validate
|
|
487
521
|
[--dry-run or -dr] Prints source and target SQL to stdout in lieu of performing a validation.
|
|
488
522
|
```
|
|
489
523
|
|
|
@@ -514,7 +548,12 @@ GCS and local paths.
|
|
|
514
548
|
You can use the `data-validation configs` command to run and view YAMLs.
|
|
515
549
|
|
|
516
550
|
```
|
|
517
|
-
data-validation
|
|
551
|
+
data-validation
|
|
552
|
+
[--verbose or -v ]
|
|
553
|
+
Verbose logging
|
|
554
|
+
[--log-level or -ll]
|
|
555
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
556
|
+
configs run
|
|
518
557
|
[--config-file or -c CONFIG_FILE]
|
|
519
558
|
Path to YAML config file to run. Supports local and GCS paths.
|
|
520
559
|
[--config-dir or -cdir CONFIG_DIR]
|
|
@@ -87,7 +87,12 @@ over all columns ('*') will only run over numeric columns, unless the
|
|
|
87
87
|
`--wildcard-include-string-len` or `--wildcard-include-timestamp` flags are present.
|
|
88
88
|
|
|
89
89
|
```
|
|
90
|
-
data-validation
|
|
90
|
+
data-validation
|
|
91
|
+
[--verbose or -v ]
|
|
92
|
+
Verbose logging
|
|
93
|
+
[--log-level or -ll]
|
|
94
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
95
|
+
validate column
|
|
91
96
|
--source-conn or -sc SOURCE_CONN
|
|
92
97
|
Source connection details
|
|
93
98
|
See: *Data Source Configurations* section for each data source
|
|
@@ -95,7 +100,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
95
100
|
Target connection details
|
|
96
101
|
See: *Connections* section for each data source
|
|
97
102
|
--tables-list or -tbls SOURCE_SCHEMA.SOURCE_TABLE=TARGET_SCHEMA.TARGET_TABLE
|
|
98
|
-
Comma separated list of tables in the form schema.table=target_schema.target_table
|
|
103
|
+
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
99
104
|
Target schema name and table name are optional.
|
|
100
105
|
i.e 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
101
106
|
[--grouped-columns or -gc GROUPED_COLUMNS]
|
|
@@ -136,6 +141,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate column
|
|
|
136
141
|
Format for stdout output. Supported formats are (text, csv, json, table). Defaults to table.
|
|
137
142
|
[--filter-status or -fs STATUSES_LIST]
|
|
138
143
|
Comma separated list of statuses to filter the validation results. Supported statuses are (success, fail). If no list is provided, all statuses are returned.
|
|
144
|
+
|
|
139
145
|
```
|
|
140
146
|
|
|
141
147
|
The default aggregation type is a 'COUNT *', which will run in addition to the validations you specify. To remove this default,
|
|
@@ -166,7 +172,12 @@ Under the hood, row validation uses
|
|
|
166
172
|
apply functions such as IFNULL() or RTRIM(). These can be edited in the YAML or JSON config file to customize your row validation.
|
|
167
173
|
|
|
168
174
|
```
|
|
169
|
-
data-validation
|
|
175
|
+
data-validation
|
|
176
|
+
[--verbose or -v ]
|
|
177
|
+
Verbose logging
|
|
178
|
+
[--log-level or -ll]
|
|
179
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
180
|
+
validate row
|
|
170
181
|
--source-conn or -sc SOURCE_CONN
|
|
171
182
|
Source connection details
|
|
172
183
|
See: *Data Source Configurations* section for each data source
|
|
@@ -184,6 +195,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate row
|
|
|
184
195
|
See: *Calculated Fields* section for details
|
|
185
196
|
--hash COLUMNS Comma separated list of columns to hash or * for all columns
|
|
186
197
|
--concat COLUMNS Comma separated list of columns to concatenate or * for all columns (use if a common hash function is not available between databases)
|
|
198
|
+
[--exclude-columns or -ec]
|
|
199
|
+
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
187
200
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
188
201
|
BigQuery destination for validation results. Defaults to stdout.
|
|
189
202
|
See: *Validation Reports* section
|
|
@@ -222,8 +235,12 @@ The command generates and stores multiple YAML validations each representing a c
|
|
|
222
235
|
The command takes the same parameters as required for `Row Validation` *plus* a few parameters to support partitioning. Single and multiple primary keys are supported and keys can be of any indexable type, except for date and timestamp type. A parameter used in earlier versions, ```partition-key``` is no longer supported.
|
|
223
236
|
|
|
224
237
|
```
|
|
225
|
-
data-validation
|
|
226
|
-
|
|
238
|
+
data-validation
|
|
239
|
+
[--verbose or -v ]
|
|
240
|
+
Verbose logging
|
|
241
|
+
[--log-level or -ll]
|
|
242
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
243
|
+
generate-table-partitions
|
|
227
244
|
--source-conn or -sc SOURCE_CONN
|
|
228
245
|
Source connection details
|
|
229
246
|
See: *Data Source Configurations* section for each data source
|
|
@@ -245,7 +262,7 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
|
|
|
245
262
|
Directory Path to store YAML Config Files
|
|
246
263
|
GCS: Provide a full gs:// path of the target directory. Eg: `gs://<BUCKET>/partitions_dir`
|
|
247
264
|
Local: Provide a relative path of the target directory. Eg: `partitions_dir`
|
|
248
|
-
--partition-num INT, -pn INT
|
|
265
|
+
--partition-num INT, -pn INT
|
|
249
266
|
Number of partitions into which the table should be split, e.g. 1000 or 10000
|
|
250
267
|
In case this value exceeds the row count of the source/target table, it will be decreased to max(source_row_count, target_row_count)
|
|
251
268
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
@@ -253,7 +270,7 @@ data-validation (--verbose or -v) (--log-level or -ll) generate-table-partitions
|
|
|
253
270
|
See: *Validation Reports* section
|
|
254
271
|
[--service-account or -sa PATH_TO_SA_KEY]
|
|
255
272
|
Service account to use for BigQuery result handler output.
|
|
256
|
-
[--parts-per-file INT], [-ppf INT]
|
|
273
|
+
[--parts-per-file INT], [-ppf INT]
|
|
257
274
|
Number of partitions in a yaml file, default value 1.
|
|
258
275
|
[--filters SOURCE_FILTER:TARGET_FILTER]
|
|
259
276
|
Colon separated string values of source and target filters.
|
|
@@ -278,7 +295,12 @@ types between source and target.
|
|
|
278
295
|
Note: An exclamation point before a data type (`!string`) signifies the column is non-nullable or required.
|
|
279
296
|
|
|
280
297
|
```
|
|
281
|
-
data-validation
|
|
298
|
+
data-validation
|
|
299
|
+
[--verbose or -v ]
|
|
300
|
+
Verbose logging
|
|
301
|
+
[--log-level or -ll]
|
|
302
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
303
|
+
validate schema
|
|
282
304
|
--source-conn or -sc SOURCE_CONN
|
|
283
305
|
Source connection details
|
|
284
306
|
See: *Data Source Configurations* section for each data source
|
|
@@ -286,7 +308,7 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
286
308
|
Target connection details
|
|
287
309
|
See: *Connections* section for each data source
|
|
288
310
|
--tables-list or -tbls SOURCE_SCHEMA.SOURCE_TABLE=TARGET_SCHEMA.TARGET_TABLE
|
|
289
|
-
Comma separated list of tables in the form schema.table=target_schema.target_table
|
|
311
|
+
Comma separated list of tables in the form schema.table=target_schema.target_table. Or shorthand schema.* for all tables.
|
|
290
312
|
Target schema name and table name are optional.
|
|
291
313
|
e.g.: 'bigquery-public-data.new_york_citibike.citibike_trips'
|
|
292
314
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
@@ -319,7 +341,12 @@ data-validation (--verbose or -v) (--log-level or -ll) validate schema
|
|
|
319
341
|
Below is the command syntax for custom query column validations.
|
|
320
342
|
|
|
321
343
|
```
|
|
322
|
-
data-validation
|
|
344
|
+
data-validation
|
|
345
|
+
[--verbose or -v ]
|
|
346
|
+
Verbose logging
|
|
347
|
+
[--log-level or -ll]
|
|
348
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
349
|
+
validate custom-query column
|
|
323
350
|
--source-conn or -sc SOURCE_CONN
|
|
324
351
|
Source connection details
|
|
325
352
|
See: *Data Source Configurations* section for each data source
|
|
@@ -381,7 +408,12 @@ in the SELECT statement of both source_query.sql and target_query.sql. See *Pri
|
|
|
381
408
|
Below is the command syntax for custom query row validations.
|
|
382
409
|
|
|
383
410
|
```
|
|
384
|
-
data-validation
|
|
411
|
+
data-validation
|
|
412
|
+
[--verbose or -v ]
|
|
413
|
+
Verbose logging
|
|
414
|
+
[--log-level or -ll]
|
|
415
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
416
|
+
validate custom-query row
|
|
385
417
|
--source-conn or -sc SOURCE_CONN
|
|
386
418
|
Source connection details
|
|
387
419
|
See: *Data Source Configurations* section for each data source
|
|
@@ -406,6 +438,8 @@ data-validation (--verbose or -v) (--log-level or -ll) validate custom-query row
|
|
|
406
438
|
(use if a common hash function is not available between databases)
|
|
407
439
|
--primary-key or -pk JOIN_KEY
|
|
408
440
|
Common column between source and target tables for join
|
|
441
|
+
[--exclude-columns or -ec]
|
|
442
|
+
Flag to indicate the list of columns provided should be excluded from hash or concat instead of included.
|
|
409
443
|
[--bq-result-handler or -bqrh PROJECT_ID.DATASET.TABLE]
|
|
410
444
|
BigQuery destination for validation results. Defaults to stdout.
|
|
411
445
|
See: *Validation Reports* section
|
|
@@ -437,7 +471,12 @@ The `validate` command takes a `--dry-run` command line flag that prints source
|
|
|
437
471
|
and target SQL to stdout as JSON in lieu of performing a validation:
|
|
438
472
|
|
|
439
473
|
```
|
|
440
|
-
data-validation
|
|
474
|
+
data-validation
|
|
475
|
+
[--verbose or -v ]
|
|
476
|
+
Verbose logging
|
|
477
|
+
[--log-level or -ll]
|
|
478
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
479
|
+
validate
|
|
441
480
|
[--dry-run or -dr] Prints source and target SQL to stdout in lieu of performing a validation.
|
|
442
481
|
```
|
|
443
482
|
|
|
@@ -468,7 +507,12 @@ GCS and local paths.
|
|
|
468
507
|
You can use the `data-validation configs` command to run and view YAMLs.
|
|
469
508
|
|
|
470
509
|
```
|
|
471
|
-
data-validation
|
|
510
|
+
data-validation
|
|
511
|
+
[--verbose or -v ]
|
|
512
|
+
Verbose logging
|
|
513
|
+
[--log-level or -ll]
|
|
514
|
+
Log Level to be assigned. Supported levels are (DEBUG,INFO,WARNING,ERROR,CRITICAL). Defaults to INFO.
|
|
515
|
+
configs run
|
|
472
516
|
[--config-file or -c CONFIG_FILE]
|
|
473
517
|
Path to YAML config file to run. Supports local and GCS paths.
|
|
474
518
|
[--config-dir or -cdir CONFIG_DIR]
|
{google_pso_data_validator-6.0.0 → google_pso_data_validator-6.2.0}/data_validation/__main__.py
RENAMED
|
@@ -24,11 +24,11 @@ from data_validation import (
|
|
|
24
24
|
cli_tools,
|
|
25
25
|
clients,
|
|
26
26
|
consts,
|
|
27
|
-
jellyfish_distance,
|
|
28
27
|
state_manager,
|
|
29
28
|
)
|
|
30
29
|
from data_validation.config_manager import ConfigManager
|
|
31
30
|
from data_validation.data_validation import DataValidation
|
|
31
|
+
from data_validation.find_tables import find_tables_using_string_matching
|
|
32
32
|
from data_validation.partition_builder import PartitionBuilder
|
|
33
33
|
|
|
34
34
|
# by default yaml dumps lists as pointers. This disables that feature
|
|
@@ -160,7 +160,7 @@ def get_aggregate_config(args, config_manager: ConfigManager):
|
|
|
160
160
|
return aggregate_configs
|
|
161
161
|
|
|
162
162
|
|
|
163
|
-
def get_calculated_config(args, config_manager) -> List[dict]:
|
|
163
|
+
def get_calculated_config(args, config_manager: ConfigManager) -> List[dict]:
|
|
164
164
|
"""Return list of formatted calculated objects.
|
|
165
165
|
|
|
166
166
|
Args:
|
|
@@ -168,12 +168,24 @@ def get_calculated_config(args, config_manager) -> List[dict]:
|
|
|
168
168
|
"""
|
|
169
169
|
calculated_configs = []
|
|
170
170
|
fields = []
|
|
171
|
-
if
|
|
172
|
-
col_list =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
if config_manager.hash:
|
|
172
|
+
col_list = (
|
|
173
|
+
None
|
|
174
|
+
if config_manager.hash == "*"
|
|
175
|
+
else cli_tools.get_arg_list(config_manager.hash)
|
|
176
|
+
)
|
|
177
|
+
fields = config_manager.build_dependent_aliases(
|
|
178
|
+
"hash", col_list, args.exclude_columns
|
|
179
|
+
)
|
|
180
|
+
elif config_manager.concat:
|
|
181
|
+
col_list = (
|
|
182
|
+
None
|
|
183
|
+
if config_manager.concat == "*"
|
|
184
|
+
else cli_tools.get_arg_list(config_manager.concat)
|
|
185
|
+
)
|
|
186
|
+
fields = config_manager.build_dependent_aliases(
|
|
187
|
+
"concat", col_list, args.exclude_columns
|
|
188
|
+
)
|
|
177
189
|
|
|
178
190
|
if len(fields) > 0:
|
|
179
191
|
max_depth = max([x["depth"] for x in fields])
|
|
@@ -190,13 +202,13 @@ def get_calculated_config(args, config_manager) -> List[dict]:
|
|
|
190
202
|
custom_params=field.get("calc_params"),
|
|
191
203
|
)
|
|
192
204
|
)
|
|
193
|
-
if
|
|
205
|
+
if config_manager.hash:
|
|
194
206
|
config_manager.append_comparison_fields(
|
|
195
207
|
config_manager.build_config_comparison_fields(
|
|
196
208
|
["hash__all"], depth=max_depth
|
|
197
209
|
)
|
|
198
210
|
)
|
|
199
|
-
elif
|
|
211
|
+
elif config_manager.concat:
|
|
200
212
|
config_manager.append_comparison_fields(
|
|
201
213
|
config_manager.build_config_comparison_fields(
|
|
202
214
|
["concat__all"], depth=max_depth
|
|
@@ -212,6 +224,7 @@ def build_config_from_args(args: Namespace, config_manager: ConfigManager):
|
|
|
212
224
|
args (Namespace): User specified Arguments
|
|
213
225
|
config_manager (ConfigManager): Validation config manager instance.
|
|
214
226
|
"""
|
|
227
|
+
|
|
215
228
|
# Append SCHEMA_VALIDATION configs
|
|
216
229
|
if config_manager.validation_type == consts.SCHEMA_VALIDATION:
|
|
217
230
|
if args.exclusion_columns is not None:
|
|
@@ -226,22 +239,18 @@ def build_config_from_args(args: Namespace, config_manager: ConfigManager):
|
|
|
226
239
|
config_manager.append_custom_query_type(args.custom_query_type)
|
|
227
240
|
|
|
228
241
|
# Get source sql query from source sql file or inline query
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
source_query_str = config_manager.get_query_from_file(
|
|
233
|
-
args.source_query_file
|
|
242
|
+
config_manager.append_source_query(
|
|
243
|
+
cli_tools.get_query_from_query_args(
|
|
244
|
+
args.source_query, args.source_query_file
|
|
234
245
|
)
|
|
235
|
-
|
|
246
|
+
)
|
|
236
247
|
|
|
237
248
|
# Get target sql query from target sql file or inline query
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
target_query_str = config_manager.get_query_from_file(
|
|
242
|
-
args.target_query_file
|
|
249
|
+
config_manager.append_target_query(
|
|
250
|
+
cli_tools.get_query_from_query_args(
|
|
251
|
+
args.target_query, args.target_query_file
|
|
243
252
|
)
|
|
244
|
-
|
|
253
|
+
)
|
|
245
254
|
|
|
246
255
|
# For custom-query column command
|
|
247
256
|
if args.custom_query_type == consts.COLUMN_VALIDATION.lower():
|
|
@@ -254,6 +263,16 @@ def build_config_from_args(args: Namespace, config_manager: ConfigManager):
|
|
|
254
263
|
comparison_fields = cli_tools.get_arg_list(
|
|
255
264
|
args.comparison_fields, default_value=[]
|
|
256
265
|
)
|
|
266
|
+
|
|
267
|
+
# As per #1190, add rstrip for Teradata string comparison fields
|
|
268
|
+
if (
|
|
269
|
+
config_manager.source_client.name == "teradata"
|
|
270
|
+
or config_manager.target_client.name == "teradata"
|
|
271
|
+
):
|
|
272
|
+
comparison_fields = config_manager.add_rstrip_to_comp_fields(
|
|
273
|
+
comparison_fields
|
|
274
|
+
)
|
|
275
|
+
|
|
257
276
|
config_manager.append_comparison_fields(
|
|
258
277
|
config_manager.build_config_comparison_fields(comparison_fields)
|
|
259
278
|
)
|
|
@@ -296,7 +315,6 @@ def build_config_from_args(args: Namespace, config_manager: ConfigManager):
|
|
|
296
315
|
config_manager.source_client.name == "teradata"
|
|
297
316
|
or config_manager.target_client.name == "teradata"
|
|
298
317
|
):
|
|
299
|
-
|
|
300
318
|
comparison_fields = config_manager.add_rstrip_to_comp_fields(
|
|
301
319
|
comparison_fields
|
|
302
320
|
)
|
|
@@ -416,71 +434,6 @@ def build_config_managers_from_yaml(args, config_file_path):
|
|
|
416
434
|
return config_managers
|
|
417
435
|
|
|
418
436
|
|
|
419
|
-
def _compare_match_tables(source_table_map, target_table_map, score_cutoff=0.8):
|
|
420
|
-
"""Return dict config object from matching tables."""
|
|
421
|
-
# TODO(dhercher): evaluate if improved comparison and score cutoffs should be used.
|
|
422
|
-
table_configs = []
|
|
423
|
-
|
|
424
|
-
target_keys = target_table_map.keys()
|
|
425
|
-
for source_key in source_table_map:
|
|
426
|
-
target_key = jellyfish_distance.extract_closest_match(
|
|
427
|
-
source_key, target_keys, score_cutoff=score_cutoff
|
|
428
|
-
)
|
|
429
|
-
if target_key is None:
|
|
430
|
-
continue
|
|
431
|
-
|
|
432
|
-
table_config = {
|
|
433
|
-
consts.CONFIG_SCHEMA_NAME: source_table_map[source_key][
|
|
434
|
-
consts.CONFIG_SCHEMA_NAME
|
|
435
|
-
],
|
|
436
|
-
consts.CONFIG_TABLE_NAME: source_table_map[source_key][
|
|
437
|
-
consts.CONFIG_TABLE_NAME
|
|
438
|
-
],
|
|
439
|
-
consts.CONFIG_TARGET_SCHEMA_NAME: target_table_map[target_key][
|
|
440
|
-
consts.CONFIG_SCHEMA_NAME
|
|
441
|
-
],
|
|
442
|
-
consts.CONFIG_TARGET_TABLE_NAME: target_table_map[target_key][
|
|
443
|
-
consts.CONFIG_TABLE_NAME
|
|
444
|
-
],
|
|
445
|
-
}
|
|
446
|
-
table_configs.append(table_config)
|
|
447
|
-
|
|
448
|
-
return table_configs
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
def get_table_map(client, allowed_schemas=None):
|
|
452
|
-
"""Return dict with searchable keys for table matching."""
|
|
453
|
-
table_map = {}
|
|
454
|
-
table_objs = clients.get_all_tables(client, allowed_schemas=allowed_schemas)
|
|
455
|
-
|
|
456
|
-
for table_obj in table_objs:
|
|
457
|
-
table_key = ".".join([t for t in table_obj if t])
|
|
458
|
-
table_map[table_key] = {
|
|
459
|
-
consts.CONFIG_SCHEMA_NAME: table_obj[0],
|
|
460
|
-
consts.CONFIG_TABLE_NAME: table_obj[1],
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
return table_map
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
def find_tables_using_string_matching(args):
|
|
467
|
-
"""Return JSON String with matched tables for use in validations."""
|
|
468
|
-
score_cutoff = args.score_cutoff or 1
|
|
469
|
-
|
|
470
|
-
mgr = state_manager.StateManager()
|
|
471
|
-
source_client = clients.get_data_client(mgr.get_connection_config(args.source_conn))
|
|
472
|
-
target_client = clients.get_data_client(mgr.get_connection_config(args.target_conn))
|
|
473
|
-
|
|
474
|
-
allowed_schemas = cli_tools.get_arg_list(args.allowed_schemas)
|
|
475
|
-
source_table_map = get_table_map(source_client, allowed_schemas=allowed_schemas)
|
|
476
|
-
target_table_map = get_table_map(target_client)
|
|
477
|
-
|
|
478
|
-
table_configs = _compare_match_tables(
|
|
479
|
-
source_table_map, target_table_map, score_cutoff=score_cutoff
|
|
480
|
-
)
|
|
481
|
-
return json.dumps(table_configs)
|
|
482
|
-
|
|
483
|
-
|
|
484
437
|
def run_raw_query_against_connection(args):
|
|
485
438
|
"""Return results of raw query for ad hoc usage."""
|
|
486
439
|
mgr = state_manager.StateManager()
|