Skip to content

Commit

Permalink
Merge develop into b/dx-292/row-condition-should-allow-whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 9, 2023
2 parents 987db34 + c5bb1cb commit ffbe52e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
11 changes: 11 additions & 0 deletions great_expectations/datasource/fluent/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def _load_datasource_subtype(cls, v: Dict[str, dict]):
f"'{ds_name}' has unsupported 'type' - {type_lookup_err}"
) from type_lookup_err

config["name"] = ds_name

if "assets" not in config:
config["assets"] = {}

for asset_name, asset_config in config["assets"].items():
asset_config["name"] = asset_name

datasource = ds_type(**config)

# the ephemeral asset should never be serialized
Expand All @@ -96,6 +104,7 @@ def _load_datasource_subtype(cls, v: Dict[str, dict]):

if v and not loaded_datasources:
logger.info(f"Of {len(v)} entries, no 'datasources' could be loaded")

return loaded_datasources

@classmethod
Expand Down Expand Up @@ -127,4 +136,6 @@ def parse_yaml(
"`_allow_empty` does not prevent unrelated validation errors"
)
raise

# noinspection PyTypeChecker
return super().parse_yaml(f)
9 changes: 2 additions & 7 deletions tests/datasource/fluent/great_expectations.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
fluent_datasources:
my_pg_ds:
type: postgres
name: my_pg_ds
connection_string: "postgresql://userName:@hostname/dbName"
assets:
my_table_asset_wo_splitters:
type: table
name: my_table_asset_wo_splitters
table_name: my_table
with_splitter:
type: table
name: with_splitter
table_name: another_table
splitter:
method_name: split_on_year_and_month
column_name: my_column
method_name: split_on_year_and_month
column_name: my_column
with_sorters:
type: table
name: with_sorters
table_name: another_table
order_by:
- key: year
- key: month
reverse: true
with_dsl_ish_sorters:
type: table
name: with_dsl_ish_sorters
table_name: another_table
order_by:
- year
Expand Down
10 changes: 0 additions & 10 deletions tests/datasource/fluent/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,9 @@
"fluent_datasources": {
"my_pg_ds": {
"connection_string": "postgresql://userName:@hostname/dbName",
"name": "my_pg_ds",
"type": "postgres",
"assets": {
"my_table_asset_wo_splitters": {
"name": "my_table_asset_wo_splitters",
"table_name": "my_table",
"type": "table",
},
Expand All @@ -51,7 +49,6 @@
"column_name": "my_column",
"method_name": "split_on_year_and_month",
},
"name": "with_splitter",
"table_name": "another_table",
"type": "table",
},
Expand All @@ -60,32 +57,27 @@
{"key": "year"},
{"key": "month", "reverse": True},
],
"name": "with_sorters",
"table_name": "yet_another_table",
"type": "table",
},
"with_dslish_sorters": {
"order_by": ["year", "-month"],
"name": "with_sorters",
"table_name": "yet_another_table",
"type": "table",
},
},
},
"my_pandas_filesystem_ds": {
"type": "pandas_filesystem",
"name": "my_pandas_filesystem_ds",
"base_directory": __file__,
"assets": {
"my_csv_asset": {
"name": "my_csv_asset",
"type": "csv",
"batching_regex": r"yellow_tripdata_sample_(?P<year>\d{4})-(?P<month>\d{2}).csv",
"sep": "|",
"names": ["col1", "col2"],
},
"my_json_asset": {
"name": "my_json_asset",
"type": "json",
"batching_regex": r"yellow_tripdata_sample_(?P<year>\d{4})-(?P<month>\d{2}).json",
"orient": "records",
Expand All @@ -99,7 +91,6 @@
SIMPLE_DS_DICT = {
"fluent_datasources": {
"my_ds": {
"name": "my_ds",
"type": "sql",
"connection_string": "sqlite://",
}
Expand All @@ -109,7 +100,6 @@
COMBINED_FLUENT_AND_OLD_STYLE_CFG_DICT = {
"fluent_datasources": {
"my_ds": {
"name": "my_ds",
"type": "sql",
"connection_string": "sqlite://",
}
Expand Down

0 comments on commit ffbe52e

Please sign in to comment.