diff --git a/funlib/persistence/graphs/pgsql_graph_database.py b/funlib/persistence/graphs/pgsql_graph_database.py index 8b8a411..5a2f4b2 100644 --- a/funlib/persistence/graphs/pgsql_graph_database.py +++ b/funlib/persistence/graphs/pgsql_graph_database.py @@ -137,7 +137,6 @@ def _read_metadata(self) -> Optional[dict[str, Any]]: return None def _select_query(self, query) -> Iterable[Any]: - print(query) self.__exec(query) return self.cur diff --git a/funlib/persistence/graphs/sql_graph_database.py b/funlib/persistence/graphs/sql_graph_database.py index 19c07fe..38a73f5 100644 --- a/funlib/persistence/graphs/sql_graph_database.py +++ b/funlib/persistence/graphs/sql_graph_database.py @@ -345,11 +345,6 @@ def read_nodes( for values in self._select_query(select_statement) ] - for values in self._select_query(select_statement): - print(values) - print(self.node_attrs.keys()) - print(nodes) - return nodes def num_nodes(self, roi: Roi) -> int: @@ -445,7 +440,7 @@ def write_edges( u, v = min(u, v), max(u, v) pos_u = self.__get_node_pos(nodes[u]) - if not roi.contains(pos_u): + if pos_u is None or not roi.contains(pos_u): logger.debug( ( f"Skipping edge with {self.endpoint_names[0]} {{}}, {self.endpoint_names[1]} {{}}," @@ -660,8 +655,11 @@ def __remove_keys(self, dictionary, keys): return {k: v for k, v in dictionary.items() if k not in keys} - def __get_node_pos(self, n: dict[str, Any]) -> Coordinate: - return Coordinate(n[self.position_attribute]) + def __get_node_pos(self, n: dict[str, Any]) -> Optional[Coordinate]: + try: + return Coordinate(n[self.position_attribute]) + except KeyError: + return None def __convert_to_sql(self, x: Any) -> str: if isinstance(x, str):