Migrate from Fetcher Alpha to Query API
To update your code from neptune_fetcher.alpha
to neptune_query
:
-
Instead of
neptune-fetcher
, install:pip install "neptune-query>=1.0.0,<2.0.0"
-
Change the import statements to the following:
import neptune_query as nq
import neptune_query.runs as nq_runs
from neptune_query.filters import Filter, Attribute, AttributeFilter -
To override the Neptune project or API token set by environment variables, use the following instead of the
Context
class:- To set the API token for the session, call
nq.set_api_token("SomeNeptuneApiToken")
. - To set the project, pass the project path to the
project
argument of any fetching method.
- To set the API token for the session, call
-
The
aggregation
argument ofAttribute
andAttributeFilter
is removed. Change your script to no longer use this parameter. -
Because the extended syntax is supported for regular expressions, some filter options have been streamlined.
-
The following
Filter
methods have been replaced:matches_all()
,matches_none()
→matches()
name_in()
,name_eq
→name()
-
The following
AttributeFilter
parameters have been replaced:name_eq
,name_in
,name_matches_all
,name_matches_none
→name
type_in
→type
-
-
The
Filter.any()
andFilter.all()
methods are removed. To join filters, use the operators|
and&
instead.