How does one use GQLAlchemy in a Django project?

I’m wondering because Neo4j has several third-party libraries such as django-neomodel that provide all the necessary.

So here there exist no such django-memgraph library. So I’m wondering, do we do one Memgraph client connection per session or just have one global for every one to use?

It seems like the global would be a bad idea since you might have multiple threads trying to access its data at once.

Hi @EnjoysMath, we don’t have a special tool, and I don’t have an example, but I have an example of an app with Flask, and I guess you can use it similarly. In the given example app, each user who starts the app locally runs their instance of Memgraph in Docker. If that app is deployed, then everyone using the app is accessing the same instance.

1 Like

Why is it possible to use the same Memgraph connection for each user? Because the server running Django could be multithreaded…

Hi @EnjoysMath, you can have unlimited number of connection to Memgraph. If you open multiple threads to Memgraph, you can access data in multithreaded way. The unlimited sessions will be handled by fixed amount of Bolt protocol threads. You can configure this via --bolt-num-workers=X Configuration settings | Memgraph Docs . If you have 6 core CPU with 2 threads per CPU on your server, this flag will be automatically set to 12.