Skip to content

Commit b2a2d7f

Browse files
committed
Completed overview documentation
1 parent cc24a8d commit b2a2d7f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/overview.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,25 @@ Here is an example showing how **python-arango-async** client can be used:
3838
student_names = []
3939
async for doc in cursor:
4040
student_names.append(doc["name"])
41+
42+
You may also use the client without a context manager, but you must ensure to close the client when done:
43+
44+
.. code-block:: python
45+
from arangoasync import ArangoClient
46+
from arangoasync.auth import Auth
47+
48+
client = ArangoClient(hosts="http://localhost:8529")
49+
auth = Auth(username="root", password="passwd")
50+
sys_db = await client.db("_system", auth=auth)
51+
52+
# Create a new database named "test".
53+
await sys_db.create_database("test")
54+
55+
# Connect to "test" database as root user.
56+
db = await client.db("test", auth=auth)
57+
58+
# List all collections in the "test" database.
59+
collections = await db.collections()
60+
61+
# Close the client when done.
62+
await client.close()

0 commit comments

Comments
 (0)