Tenori

Latest version: v1.1.3

Safety actively analyzes 723217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.1.3

Automated Schema Creation for Tenant Databases

This release adds automatic schema creation functionality for newly created tenant databases, significantly improving the setup process for new tenants.

🌟 New Features
- Automatic table creation in tenant databases
- Schema replication from main application
- Safe engine swapping mechanism
- Proper cleanup after schema creation

🔧 Technical Improvements
python
Before
CREATE DATABASE IF NOT EXISTS `{db_name}`;
Manual schema creation needed

After
CREATE DATABASE IF NOT EXISTS `{db_name}`;
Automatic schema creation:
self._db_instance.create_all() Tables automatically created


🛠️ Changes
- Added temporary engine swapping mechanism
- Implemented safe context management for database operations
- Added automatic table creation after database initialization
- Improved error handling during schema creation

🔒 Security
- Maintains proper isolation between tenant databases
- Preserves original database connections
- Safe handling of database credentials

🐛 Bug Fixes
- Fixed potential connection leaks during schema creation
- Ensured proper engine restoration after operations

📝 Usage Notes
No changes required to existing code. Schema creation is now automatic when creating new tenant databases.

🔍 Breaking Changes
None. This is a backward-compatible enhancement.

---

For Developers
If you need to customize the schema creation process, you can override the relevant methods in your implementation.

Migration Guide
Existing tenants are unaffected. New tenants will automatically receive the complete database schema.

---
For complete documentation, please refer to our [README.md](README.md)

**Full Changelog**: https://github.com/TaqsBlaze/tenori/compare/v1.1.1...v1.1.3

1.1.1

Package Structure Fix

This patch release resolves package distribution issues ensuring all components are properly included in the PyPI package.

🔧 Technical Fixes
- Corrected package directory structure to properly include all Python modules
- Ensured proper module discovery during package installation
- Fixed PyPI distribution to include all necessary package files

📁 Directory Structure

tenori/
├── tenori/
│ ├── __init__.py
│ ├── core.py
│ ├── database.py
│ ├── exceptions.py


├── setup.py
├── README.md
├── requirements.txt
└── MANIFEST.in


🔍 What's Changed
- Package now installs correctly via pip
- All modules are properly accessible after installation
- No changes to functionality or API

📝 Notes for Users
- If you experienced incomplete installations previously, please upgrade to this version
- No breaking changes or API modifications

---
For full documentation, please refer to our [README.md](README.md)

**Full Changelog**: https://github.com/TaqsBlaze/tenori/compare/v1.1.0...v1.1.1

1.1.0

Enhanced Database User Management

This minor release improves tenant isolation by automatically creating dedicated database users for each tenant database.

🔑 What's New
- Automated user creation with each tenant database
- Secure password handling for tenant users
- Granular permissions management per tenant
- Database users are now scoped to their specific tenant database

🔍 Technical Changes
python
Before
CREATE DATABASE IF NOT EXISTS {db_name}

After
CREATE DATABASE IF NOT EXISTS {db_name};
CREATE USER '{username}''localhost' IDENTIFIED WITH mysql_native_password USING '{password_hash}';
GRANT ALL PRIVILEGES ON {db_name}.* TO '{username}''localhost';
FLUSH PRIVILEGES;


🔒 Security Improvements
- Each tenant now has a dedicated database user
- Tenant users can only access their own database
- Improved isolation between tenant data
- Secure password hashing for tenant users

🐛 Bug Fixes
- None

📝 Documentation Updates
- Updated database configuration examples
- Added new user management section to README

---
For full documentation, please refer to our [README.md](README.md)

**Full Changelog**: https://github.com/TaqsBlaze/tenori/compare/v1.0.0...v1.1.0

1.0.0

We're excited to announce the initial release of Flask Tanori, a powerful package that simplifies the implementation of multi tenancy in Flask applications through dedicated databases.

🌟 Key Features

Core Functionality
- **Automated Database Creation**: Seamlessly create dedicated databases for each tenant
- **Secure Database Management**: Built in protection against SQL injection through database name sanitization
- **SQLAlchemy Integration**: Smooth integration with existing Flask-SQLAlchemy applications
- **Dynamic Connection Strings**: Automatic generation of tenant-specific database connections

Developer Experience
- **Type Hints**: Comprehensive type annotations for better IDE support
- **Flexible API**: Simple yet powerful interface for tenant management
- **Custom Exceptions**: Detailed error handling for better debugging
- **Minimal Configuration**: Get started with just a few lines of code

💻 Installation

bash
pip install flask-multitenant


🔧 Usage

Basic setup example:
python
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from tenori import MultiTenantManager

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://rootlocalhost/<main_db>'
db = SQLAlchemy(app)
tenant_manager = MultiTenantManager(db)

Create a new tenant database
success = tenant_manager.create_tenant(user)


🔍 Dependencies
- Python 3.7+
- Flask 2.0.0+
- Flask-SQLAlchemy 2.5.0+
- SQLAlchemy 1.4.0+
- PyMySQL 1.0.0+

📝 Breaking Changes
- None (Initial Release)

🐛 Bug Fixes
- None (Initial Release)

🔒 Security Notes
- Implemented database name sanitization
- Secure connection string handling
- Protected against SQL injection attacks

📚 Documentation
Full documentation is available in the [README.md](README.md)

🛠 Known Issues
- None reported yet. Please submit any issues you find!

🔜 Coming Soon
- Database migration support
- Tenant data backup utilities
- Enhanced logging capabilities
- Additional database engine support
- CLI tools for tenant management

📋 Prerequisites
Ensure your database user has appropriate privileges:
sql
GRANT CREATE, DROP ON *.* TO 'your_user''localhost';


💡 Feedback
We welcome your feedback and contributions! Please feel free to:
- Open issues for bug reports
- Submit feature requests
- Create pull requests
- Join discussions

🙏 Acknowledgments
Special thanks to all the early testers and contributors who helped shape this initial release.

---
**Note**: This is an alpha release. While the core functionality is stable, please test thoroughly in a non production environment first.

**Full Changelog**: https://github.com/TaqsBlaze/tenori/commits/v1.0.0

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.