Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new: fully support parameterized db object #70

Merged
merged 5 commits into from
Jan 6, 2025
Merged

Conversation

aMahanna
Copy link
Member

@aMahanna aMahanna commented Jan 3, 2025

There are limitations with using the NetworkX Config objects to store connection credentials, as that prevents the user from having multiple connections to different ArangoDB databases in one Python session.

This PR minimizes the use of the NetworkX Config object in favour of storing connection information on a per-Graph-object basis.

Related to #68

In other words:

from arango import ArangoClient
import nx_arangodb as nxadb

db_1 = ArangoClient("http://my_first_deployment:8529").db(...)
db_2 = ArangoClient("http://my_second_deployment:8529").db(...)

G1 = nxadb.Graph(name="MyGraph", db=db_1)

G2 = nxadb.Graph(name="MyGraph2", db=db_2)

Also introduces support for passing use_gpu to NetworkX Algorithms, e.g nx.pagerank(G1, use_gpu=False)

self.__db = db
self._db_name = db.name
self._hosts = db._conn._hosts
self._username, self._password = db._conn._auth
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting environment variables (i.e DATABASE_HOST, DATABASE_USER, etc.) is still supported, but passing a custom db object will take priority over env vars

@aMahanna aMahanna merged commit bd47753 into main Jan 6, 2025
7 checks passed
@aMahanna aMahanna deleted the fully-parameterize-db branch January 6, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant