CAVEconnectome / CAVEclient

This is the python client for accessing REST APIs within the Connectome Annotation Versioning Engine.
https://caveconnectome.github.io/CAVEclient/
MIT License
19 stars 12 forks source link

Error: No row was found for one() #180

Open schlegelp opened 2 months ago

schlegelp commented 2 months ago

When trying to query a view that (I assume) did not yet exist at a given materialization we get a rather cryptic error:

>>> public = cv.CAVEclient('flywire_fafb_public')

>>> client.materialize.query_view('valid_synapses_nt_np_v5', limit=10, materialization_version=783)
   id      pre_pt_root_id     post_pt_root_id  connection_score  ...  post_pt_supervoxel_id  neuropil          pre_pt_position         post_pt_position
0   6  720575940630786105  720575940610739662        389.255432  ...      76916748439640439    AVLP_L  [366592, 246144, 74360]  [366584, 246216, 74320]
1  11  720575940630786105  720575940545913232        469.296295  ...      76916748439645298    AVLP_L  [366560, 246144, 74440]  [366508, 246232, 74440]
2  14  720575940630786105  720575940545912208        431.531738  ...      76916748439646534    AVLP_L  [366428, 246060, 74560]  [366356, 246136, 74520]
3  15  720575940630906435  720575940627911895        475.069672  ...      76916748439647565    AVLP_L  [365584, 245064, 74680]  [365672, 245036, 74640]
4  16  720575940630906435  720575940545916816        407.200562  ...      76916748439648883    AVLP_L  [365624, 245136, 74680]  [365712, 245200, 74720]
5  18  720575940630786105  720575940545920912        217.466217  ...      76916748439651348    AVLP_L  [366252, 245948, 74640]  [366168, 245976, 74640]
6  21  720575940630786105  720575940624184764         56.978813  ...      76916748439650144    AVLP_L  [366232, 246012, 74680]  [366136, 246084, 74640]
7  22  720575940630906435  720575940545901968        478.272552  ...      76916748439653785    AVLP_L  [365624, 245112, 74720]  [365732, 245096, 74720]
8  26  720575940619149904  720575940627911895         58.005123  ...      76916748439648983    AVLP_L  [365704, 246068, 74720]  [365656, 245948, 74720]
9  27  720575940619149904  720575940545911952         17.302750  ...      76916748439651344    AVLP_L  [365756, 246080, 74720]  [365800, 245980, 74720]

[10 rows x 17 columns]

>>> client.materialize.query_view('valid_synapses_nt_np_v5', limit=10, materialization_version=630)
HTTPError: 500 Server Error: No row was found for one() for url: https://prod.flywire-daf.com/materialize/api/v3/datastack/flywire_fafb_public/version/630/views/valid_synapses_nt_np_v5/query?return_pyarrow=True&arrow_format=True&split_positions=True content:b'{"code": 500, "message": "No row was found for one()", "traceback": ["Traceback (most recent call last):\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask/app.py\\", line 1516, in full_dispatch_request\\n    rv = self.dispatch_request()\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask/app.py\\", line 1502, in dispatch_request\\n    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask_restx/api.py\\", line 403, in wrapper\\n    resp = resource(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask/views.py\\", line 84, in view\\n    return current_app.ensure_sync(self.dispatch_request)(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask_restx/resource.py\\", line 49, in dispatch_request\\n    resp = meth(*args, **kwargs)\\n", "  File \\"/app/./materializationengine/blueprints/reset_auth.py\\", line 12, in decorated_function\\n    return f(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/middle_auth_client/decorators.py\\", line 265, in decorated_function\\n    return f(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/middle_auth_client/decorators.py\\", line 396, in decorated_function\\n    return f(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask_limiter/extension.py\\", line 1186, in __inner\\n    R, flask.current_app.ensure_sync(cast(Callable[P, R], obj))(*a, **k)\\n", "  File \\"/app/./materializationengine/blueprints/client/datastack.py\\", line 70, in wrapper\\n    return f(*args, **kwargs)\\n", "  File \\"/app/./materializationengine/blueprints/client/datastack.py\\", line 80, in wrapper\\n    return f(*args, **kwargs)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/flask_accepts/decorators/decorators.py\\", line 206, in inner\\n    return func(*args, **kwargs)\\n", "  File \\"/app/./materializationengine/blueprints/client/api2.py\\", line 1374, in post\\n    md = mat_db.database.get_view_metadata(datastack_name, view_name)\\n", "  File \\"/usr/local/lib/python3.9/site-packages/dynamicannotationdb/database.py\\", line 127, in get_view_metadata\\n    result = query.one()\\n", "  File \\"/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py\\", line 3500, in one\\n    raise orm_exc.NoResultFound(\\"No row was found for one()\\")\\n", "sqlalchemy.orm.exc.NoResultFound: No row was found for one()\\n"]}\n'

Took me a while before I realised what was happening here. A more informative error (maybe even on the cave-client side) would be nice.