Skip to content

Commit 1690b6f

Browse files
Removed an unecessary check for entity type. Removed unecessary formatting of uuids list. Added missing parameter to function comment block
1 parent c584cb5 commit 1690b6f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/schema/schema_neo4j_queries.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,17 @@ def get_entity(neo4j_driver, uuid):
122122
The neo4j database connection pool
123123
direct_ancestor_uuids : list
124124
List of the uuids to be filtered
125+
entity_type : string
126+
The entity to be excluded
125127
126128
Returns
127129
-------
128130
dict
129131
A dictionary of entity uuids that don't pass the filter, grouped by entity_type
130132
"""
131133
def filter_ancestors_by_type(neo4j_driver, direct_ancestor_uuids, entity_type):
132-
uuids_str = ", ".join([f'"{uuid}"' for uuid in direct_ancestor_uuids])
133134
query = (f"MATCH (e:Entity) "
134-
f"WHERE e.uuid in [{uuids_str}] AND toLower(e.entity_type) <> '{entity_type.lower()}' "
135+
f"WHERE e.uuid in {direct_ancestor_uuids} AND toLower(e.entity_type) <> '{entity_type.lower()}' "
135136
f"RETURN e.entity_type AS entity_type, collect(e.uuid) AS uuids")
136137
logger.info("======filter_ancestors_by_type======")
137138
logger.info(query)

src/schema/schema_validators.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,6 @@ def validate_creation_action(property_key, normalized_entity_type, request, exis
586586
if creation_action == '':
587587
raise ValueError(f"The property {property_key} cannot be empty, when specified.")
588588
if creation_action == 'external process':
589-
if normalized_entity_type.lower() != "dataset":
590-
raise ValueError(f"Only datasets are allowed to have creation_action of 'external_process'. Provided entity is a {normalized_entity_type}")
591589
direct_ancestor_uuids = new_data_dict.get('direct_ancestor_uuids')
592590
entity_types_dict = schema_neo4j_queries.filter_ancestors_by_type(schema_manager.get_neo4j_driver_instance(), direct_ancestor_uuids, "dataset")
593591
if entity_types_dict:

0 commit comments

Comments
 (0)