Skip to content

Commit

Permalink
feat: Remove dependency on tables list for custom query (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
sramsrinivasan committed Jul 14, 2022
1 parent f7ed739 commit 7dca5bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data_validation/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def build_config_managers_from_args(args):

is_filesystem = source_client._source_type == "FileSystem"
tables_list = cli_tools.get_tables_list(
args.tables_list, default_value=[], is_filesystem=is_filesystem
args.tables_list, default_value=[{}], is_filesystem=is_filesystem
)

for table_obj in tables_list:
Expand Down
10 changes: 6 additions & 4 deletions data_validation/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,15 @@ def build_config_manager(
consts.CONFIG_TYPE: config_type,
consts.CONFIG_SOURCE_CONN_NAME: source_conn_name,
consts.CONFIG_TARGET_CONN_NAME: target_conn_name,
consts.CONFIG_TABLE_NAME: table_obj[consts.CONFIG_TABLE_NAME],
consts.CONFIG_SCHEMA_NAME: table_obj[consts.CONFIG_SCHEMA_NAME],
consts.CONFIG_TABLE_NAME: table_obj.get(consts.CONFIG_TABLE_NAME, None),
consts.CONFIG_SCHEMA_NAME: table_obj.get(consts.CONFIG_SCHEMA_NAME, None),
consts.CONFIG_TARGET_SCHEMA_NAME: table_obj.get(
consts.CONFIG_TARGET_SCHEMA_NAME, table_obj[consts.CONFIG_SCHEMA_NAME]
consts.CONFIG_TARGET_SCHEMA_NAME,
table_obj.get(consts.CONFIG_SCHEMA_NAME, None),
),
consts.CONFIG_TARGET_TABLE_NAME: table_obj.get(
consts.CONFIG_TARGET_TABLE_NAME, table_obj[consts.CONFIG_TABLE_NAME]
consts.CONFIG_TARGET_TABLE_NAME,
table_obj.get(consts.CONFIG_TABLE_NAME, None),
),
consts.CONFIG_LABELS: labels,
consts.CONFIG_THRESHOLD: threshold,
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ validations:

#### Run a custom query column validation
````shell script
data-validation validate --custom-query-type column custom-query --source-query-file source_query.sql --target-query-file target_query.sql -sc my_bq_conn -tc my_bq_conn -tbls bigquery-public-data.new_york_citibike.citibike_stations
data-validation validate custom-query --custom-query-type column --source-query-file source_query.sql --target-query-file target_query.sql -sc my_bq_conn -tc my_bq_conn
````

#### Run a custom query validation with sum aggregation
Expand Down

0 comments on commit 7dca5bd

Please sign in to comment.