A lightweight Python client for interacting with a ProtonDB-like server
Project description
ProtonDB Python Wrapper
This Python wrapper provides a simple interface to interact with ProtonDB, a custom TCP-based NoSQL database.
It wraps ProtonDB commands into Python method calls, allowing you to execute database, collection, document, user, and utility commands through a consistent API.
Complete Command Reference
1. Initialization
from ProtonDBclient import ProtonDBClient client = ProtonDBClient("localhost", 9090, "admin420", "1234") # Connect client.close() # Disconnect
2. 🗃️ Database Commands
client.driver.execute("db.create('mydb')") # Create database client.driver.execute("db.drop('mydb')") # Delete database client.driver.execute("db.use('mydb')") # Switch to database client.driver.execute("db.list()") # List all databases
3.📁 Collection Commands
client.driver.execute("collection.create('users')") # Create collection client.driver.execute("collection.drop('users')") # Delete collection client.driver.execute("collection.list()") # List collections
4. 📄 Document Commands
Insert Documents: client.driver.execute('users.insert({"name":"John"})') # Insert single document client.driver.execute('users.insert([{"name":"Alice"}, {"name":"Bob"}])') # Insert multiple documents
Query Documents: client.driver.execute("users.print()") # Print all documents client.driver.execute("users.print(age >= 18)") # Print documents with filter
Update Documents: client.driver.execute('users.update(add, {"role":"admin"}, name="John")') # Add field "role":"admin" to docs where name="John" client.driver.execute('users.update(drop, "temp_field")') # Remove field "temp_field" from all documents
Delete Documents: client.driver.execute("users.remove(age < 18)") # Remove documents matching condition client.driver.execute("users.remove()") # Remove all documents
5. 👤 Profile (User) Commands
client.driver.execute('profile.create("user1", "pass123", "user")') # Create user client.driver.execute('profile.delete("user1")') # Delete user client.driver.execute('profile.grant("user1", "mydb")') # Grant access to database client.driver.execute('profile.revoke("user1", "mydb")') # Revoke access client.driver.execute("profile.list()") # List all users
6. 🧰 Utility Commands
client.driver.execute("--help") # Show help client.driver.execute("--version") # Show version client.driver.execute("cls") # Clear screen
7. 🧾Multi-line Insert Example
client.driver.execute('''users.insert(. {"name": "John", "age": 25}, {"name": "Alice", "age": 30} .)''')
8.📝Notes:
- Use client.driver.execute("") to send any ProtonDB command string.
- Keep the command strings exactly as ProtonDB expects (quotes, parentheses, etc.).
- Close connection with client.close() after your operations to free resources.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyprotondb-0.1.0.tar.gz.
File metadata
- Download URL: pyprotondb-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04bad4b5f0b7b16dd0dc89bade731345e2ac71accc1fb256fa2e40b6f679deda
|
|
| MD5 |
b6341f5191a77e8afc13b0a16343d493
|
|
| BLAKE2b-256 |
4ba25cc3f46f073cc6df53de6a6862e58c3211a37771e91efc622a3bb6343bda
|
File details
Details for the file pyprotondb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyprotondb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a88330537f1ea5eb2ea9f7ecd55e73064c569b53a53226afd4b881411bc481f4
|
|
| MD5 |
8ec92277ff8122fc388154a887b6d5a4
|
|
| BLAKE2b-256 |
49b8c979d465a4e5c5c2e5ef3b6f5252c7479d1f70b8dd50b88e3c7b270d5292
|