diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6cb9065..b105d83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ env: jobs: build: runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: python: ["3.8", "3.9", "3.10", "3.11", "3.12"] diff --git a/adbnx_adapter/adapter.py b/adbnx_adapter/adapter.py index 44612d2..4fc75f8 100644 --- a/adbnx_adapter/adapter.py +++ b/adbnx_adapter/adapter.py @@ -144,7 +144,7 @@ def arangodb_to_networkx( # 1. Fetch ArangoDB vertices v_col_cursor, v_col_size = self.__fetch_adb_docs( - v_col, atribs, explicit_metagraph, **adb_export_kwargs + v_col, False, atribs, explicit_metagraph, **adb_export_kwargs ) # 2. Process ArangoDB vertices @@ -162,12 +162,12 @@ def arangodb_to_networkx( # Edge Collections # #################### - for e_col, atribs in metagraph["edgeCollections"].items(): + for e_col, atribs in metagraph.get("edgeCollections", {}).items(): logger.debug(f"Preparing '{e_col}' edges") # 1. Fetch ArangoDB edges e_col_cursor, e_col_size = self.__fetch_adb_docs( - e_col, atribs, explicit_metagraph, **adb_export_kwargs + e_col, True, atribs, explicit_metagraph, **adb_export_kwargs ) # 2. Process ArangoDB edges @@ -421,6 +421,7 @@ def networkx_to_arangodb( def __fetch_adb_docs( self, col: str, + is_edge: bool, attributes: Set[str], explicit_metagraph: bool, **adb_export_kwargs: Any, @@ -429,6 +430,8 @@ def __fetch_adb_docs( :param col: The ArangoDB collection. :type col: str + :param is_edge: True if **col** is an edge collection. + :type is_edge: bool :param attributes: The set of document attributes. :type attributes: Set[str] :param explicit_metagraph: If True, only return the set of **attributes** @@ -443,13 +446,9 @@ def __fetch_adb_docs( """ aql_return_value = "doc" if explicit_metagraph: - aql_return_value = f""" - MERGE( - KEEP(doc, {list(attributes)}), - {{"_id": doc._id}}, - doc._from ? {{"_from": doc._from, "_to": doc._to}}: {{}} - ) - """ + default_keys = ["_id", "_key"] + default_keys += ["_from", "_to"] if is_edge else [] + aql_return_value = f"KEEP(doc, {list(attributes) + default_keys})" col_size: int = self.__db.collection(col).count()