File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff 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()
You can’t perform that action at this time.
0 commit comments