AccessNode Database Manager
A secure and flexible database management system that provides both SDK and API access to multiple database types.
AccessNode serves as a unified interface for database operations across PostgreSQL, MySQL, MongoDB, and SQLite, offering both direct Python integration and REST API access.
🚀 Features
Core Capabilities
- 🗄️ Multi-database support: PostgreSQL, MySQL, MongoDB, SQLite
- 🔐 Secure authentication: JWT tokens with encrypted credential storage
- ⚡ Async operations: Full async/await support for high performance
- 🎯 Dual access modes: Use as Python SDK or REST API service
- 🔄 Schema management: Dynamic schema creation, validation, and migration
- 💾 Smart caching: Memory and Redis caching strategies
- 🔌 Plugin architecture: Extensible for new database types
Security Features
- Encrypted database credentials at rest
- bcrypt password hashing
- JWT authentication
- CORS protection
- Safe query execution
📦 Installation
For SDK Usage
pip install accessnode-db-manager
For Development
# Clone and install with dev dependencies
git clone <repository-url>
cd AccessNode
pip install -e ".[dev]"
🔧 Quick Start
SDK Usage (Direct Python Integration)
from accessnode import AccessNode
# Initialize database connection
db = AccessNode(
db_type="postgres",
database_name="your_db",
host="localhost",
port=5432,
username="user",
password="pass"
)
# Initialize the connection
await db.initialize()
# Execute raw queries
results = await db.raw_query("SELECT * FROM your_table")
# Use built-in operations
user_data = await db.get("users", {"id": 1})
new_id = await db.insert("users", {"name": "John", "email": "john@example.com"})
API Service Usage
- Start the server:
uvicorn main:app --reload
- Register and authenticate:
# Register a user
curl -X POST "http://localhost:8000/user/register" \
-H "Content-Type: application/json" \
-d '{"username": "testuser", "password": "testpass"}'
# Get access token
curl -X POST "http://localhost:8000/user/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=testuser&password=testpass"
- Set up database connection:
curl -X POST "http://localhost:8000/user/databases/setup" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my_postgres_db",
"db_type": "postgres",
"host": "localhost",
"port": 5432,
"database_name": "mydb",
"username": "user",
"password": "pass"
}'
📚 Advanced Usage
Schema Management
# Enable schema enforcement
db = AccessNode(
db_type="postgres",
database_name="mydb",
enforce_schemas=True,
auto_sync=True
)
# Schema will be automatically managed
await db.initialize()
Caching
from accessnode.caching.redis_cache import RedisCache
# Initialize with Redis caching
cache = RedisCache(host="localhost", port=6379)
db = AccessNode(
db_type="postgres",
database_name="mydb",
cache=cache
)
Multiple Database Types
# PostgreSQL
pg_db = AccessNode(db_type="postgres", database_name="pg_db", ...)
# MongoDB
mongo_db = AccessNode(db_type="mongodb", database_name="mongo_db", ...)
# MySQL
mysql_db = AccessNode(db_type="mysql", database_name="mysql_db", ...)
🔌 API Endpoints
Authentication
POST /user/register- Register a new userPOST /user/token- Login and get access token
Database Management
POST /user/databases/setup- Configure a new database connectionGET /user/databases- List user's database connectionsDELETE /user/databases/{db_id}- Remove a database connection
Query Operations
POST /user/database/{db_id}/query- Execute database queriesGET /user/database/{db_id}/tables- List tables in database
Visit /docs after starting the server for interactive API documentation.
🛠️ Development
Setup
# Install dependencies
pip install -e ".[dev]"
# Set up environment variables
export POSTGRES_USER=your_user
export POSTGRES_PASSWORD=your_password
export POSTGRES_HOST=localhost
export POSTGRES_DB=accessnode_main
Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=accessnode
# Run specific test file
pytest tests/test_accessnode.py -v
Code Quality
# Format code
black .
# Sort imports
isort .
# Lint code
ruff check .
# Type checking
mypy accessnode/
🏗️ Architecture
AccessNode follows a modular architecture:
- Core Layer: Main AccessNode class and base interfaces
- Database Layer: Database-specific handlers and connection pooling
- Schema Layer: Dynamic schema management and validation
- Query Layer: Cross-database query building and compilation
- Caching Layer: Multiple caching strategies and cache-aware operations
- API Layer: FastAPI routes and authentication
- Security Layer: Encryption, hashing, and secure credential management
🔒 Security
- Encrypted storage: Database credentials encrypted at rest using AES
- Password security: bcrypt hashing for user passwords
- Token-based auth: JWT tokens for API authentication
- Input validation: Comprehensive input validation and sanitization
- Connection security: Secure database connection handling
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🆘 Support
- Documentation: Visit
/docsendpoint when running the API - Issues: Report bugs and request features via GitHub Issues
- Community: Join our discussions for questions and collaboration
Metadata
Release files for accessnode 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| accessnode-0.1.1.tar.gz | 116.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| accessnode-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 205.6 kB
Release files / accessnode-0.1.1.tar.gz
| Download URL | accessnode-0.1.1.tar.gz |
|---|---|
| Size | 116.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ea30e8c045a70a1bee1f51d6def567a5ffa8ac4f2bcc45e32c0a4e735ef9685
|
|
BLAKE2b-256 checksum How to use checksums |
89568786f83aabf4adc9c3c683ce3f56b6308836fc72047a0add518e67a7b95f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / accessnode-0.1.1-py3-none-any.whl
| Download URL | accessnode-0.1.1-py3-none-any.whl |
|---|---|
| Size | 88.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5f3714dc17f12c3230aafd1daa1c6a3d1ba7e9acf46f91cfbe671bbb73c2778
|
|
BLAKE2b-256 checksum How to use checksums |
ac98ba768111a7d516b2582e2c3f5f0f65167923cb91809b0c6ae6802a304ebd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for accessnode 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.