Skip to content

Commit

Permalink
Include Neptune parameters in default %graph_notebook_config (#605)
Browse files Browse the repository at this point in the history
* Set Neptune parameters in %graph_notebook_config default

* remove unused import

* update changelog

* update changelog
  • Loading branch information
michaelnchin authored Jun 4, 2024
1 parent 7b1832f commit 57be198
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
1 change: 1 addition & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Starting with v1.31.6, this file will contain a record of major features and updates made in each release of graph-notebook.

## Upcoming
- Updated default %graph_notebook_config to display Neptune-specific fields ([Link to PR](https://github.com/aws/graph-notebook/pull/605))

## Release 4.3.0 (June 3, 2024)

Expand Down
11 changes: 10 additions & 1 deletion src/graph_notebook/configuration/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,16 @@ def generate_config(host, port, auth_mode: AuthModeEnum = AuthModeEnum.DEFAULT,


def generate_default_config():
c = generate_config('change-me', 8182, AuthModeEnum.DEFAULT, True, True, NEPTUNE_DB_SERVICE_NAME, '', DEFAULT_REGION)
neptune_hosts_with_dummy = NEPTUNE_CONFIG_HOST_IDENTIFIERS + ['change-me']
c = generate_config(host='change-me',
port=8182,
auth_mode=AuthModeEnum.DEFAULT,
ssl=True,
ssl_verify=True,
neptune_service=NEPTUNE_DB_SERVICE_NAME,
load_from_s3_arn='',
aws_region=DEFAULT_REGION,
neptune_hosts=neptune_hosts_with_dummy)
return c


Expand Down
25 changes: 24 additions & 1 deletion test/unit/configuration/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from graph_notebook.configuration.get_config import get_config
from graph_notebook.configuration.generate_config import Configuration, DEFAULT_AUTH_MODE, AuthModeEnum, \
generate_config, GremlinSection
generate_config, generate_default_config, GremlinSection
from graph_notebook.neptune.client import NEPTUNE_DB_SERVICE_NAME, NEPTUNE_ANALYTICS_SERVICE_NAME


Expand All @@ -32,6 +32,29 @@ def tearDown(self) -> None:
if os.path.exists(self.test_file_path):
os.remove(self.test_file_path)

def test_generate_default_config(self):
config = generate_default_config()
self.assertEqual(True, config.is_neptune_config)
self.assertEqual('change-me', config.host)
self.assertEqual(8182, config.port)
self.assertEqual('', config._proxy_host)
self.assertEqual(8182, config.proxy_port)
self.assertEqual(DEFAULT_AUTH_MODE, config.auth_mode)
self.assertEqual(True, config.ssl)
self.assertEqual(True, config.ssl_verify)
self.assertEqual('neptune-db', config.neptune_service)
self.assertEqual('', config.load_from_s3_arn)
self.assertEqual('us-east-1', config.aws_region)
self.assertEqual('sparql', config.sparql.path)
self.assertEqual('g', config.gremlin.traversal_source)
self.assertEqual('', config.gremlin.username)
self.assertEqual('', config.gremlin.password)
self.assertEqual('graphsonv3', config.gremlin.message_serializer)
self.assertEqual('neo4j', config.neo4j.username)
self.assertEqual('password', config.neo4j.password)
self.assertEqual(True, config.neo4j.auth)
self.assertEqual(None, config.neo4j.database)

def test_configuration_default_auth_defaults_neptune_reg(self):
config = Configuration(self.neptune_host_reg, self.port)
self.assertEqual(self.neptune_host_reg, config.host)
Expand Down

0 comments on commit 57be198

Please sign in to comment.