NASA-PDS / pds4-information-model

The software tools and data necessary for generating the Information Model including PDS4 ontology, data, and information model.
https://nasa-pds.github.io/pds4-information-model/
Other
9 stars 6 forks source link

Develop initial prototype in AWS Neptune Notebooks #388

Closed jordanpadams closed 2 years ago

jordanpadams commented 2 years ago

notes from today's tag-up today with @TWilson2017:

action items:

jordanpadams commented 2 years ago
jordanpadams commented 2 years ago
jordanpadams commented 2 years ago
jordanpadams commented 2 years ago

@TWilson2017 so after doing some sleuthing, it looks like it is possible to use IAM and the botocore library to connect to neptune.

per our initial testing with neptune, we used this graph-notebook library to access the database. the confusing part was we were using these notebook "magic" extensions to access things and query the database: https://github.com/aws/graph-notebook#notebook-cell-magic-extensions-in-the-ipython-3-kernel . and per our original testing, we used our IAM role to access the database, similar to this:

%%graph_notebook_config
{
  "host": "your-neptune-endpoint",
  "port": 8182,
  "auth_mode": "IAM",
  "load_from_s3_arn": "",
  "ssl": true,
  "aws_region": "your-neptune-region"
}

so what we need to do is access this client from the Python API without the "magic" extensions.

that client is here: https://github.com/aws/graph-notebook/blob/main/src/graph_notebook/neptune/client.py

so i think we want to do something like this integration test they have:

def setup_client_builder(config: Configuration) -> ClientBuilder:
    builder = ClientBuilder() \
        .with_host(config.host) \
        .with_port(config.port) \
        .with_region(config.aws_region) \
        .with_tls(config.ssl) \
        .with_sparql_path(config.sparql.path)

    if config.auth_mode == AuthModeEnum.IAM:
        builder = builder.with_iam(get_session())

    return builder

where config is a dictionary similar to the one we have coming from %%graph_notebook_config

jordanpadams commented 2 years ago
jordanpadams commented 2 years ago

initial version completed. see XML_to_RDF notebook in Neptune Workbench