Reusable library for tab management using SQLAlchemy
Project description
SuperTab: A Tab Management Library
Overview
supertab is a Python library designed to simplify tab management with SQLAlchemy and a MySQL database. It provides a reusable interface for managing tabs, allowing for operations like creating, closing, reordering, and querying tabs.
Features
- Manage hierarchical tab structures.
- Seamless integration with SQLAlchemy.
- Easily create and update database records for tabs.
- Handle tab-specific logic like ordering and level-based hierarchies.
Installation
Prerequisite
Ensure Python 3.7+ is installed.
Local Installation
Clone this repository:
git clone https://gitlab.com/bydata/pypi-manager/supertab
cd supertab
pip install .
Getting Started
1. Setting Up the Database
Use the init_engine function to initialize the database connection:
from supertab import init_engine
DATABASE_URL = "mysql+pymysql://username:password@hostname/super_tab"
engine = init_engine(DATABASE_URL, pool_size=10)
2. Creating Tables
Automatically create tables in the database:
from supertab import Base
Base.metadata.create_all(bind=engine)
3. Using the TabManager
Create an instance of TabManager:
from supertab import TabManager
tab_manager = TabManager(engine)
Examples
Example: Open a Tab tab_info = {"title": "Home", "url": "/home"} new_tab = tab_manager.open_tab( unique_identifier="user123", created_by=1, tab_info=tab_info, parent_tab_id=None ) print(new_tab)
Example: Close a Tab tab_manager.close_tab(tab_id=42)
Example: Reorder Tabs tab_manager.reorder_tabs(tab_id=42, new_order=3)
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 supertab-1.0.1.tar.gz.
File metadata
- Download URL: supertab-1.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7f27505412d80b85188704bd5469fede9256c86caabd3122b0930b3c8568846
|
|
| MD5 |
43cc78a043cfb048d64ce82898cac409
|
|
| BLAKE2b-256 |
a6da74b88ecbe5a4b5995e947b6c5cb47979a5e8dbe6f11a11136161f0dce997
|
File details
Details for the file supertab-1.0.1-py3-none-any.whl.
File metadata
- Download URL: supertab-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0ba8b280a50a382dfe61bf610786b680c4fd54200592eed7c533772a0c3972e
|
|
| MD5 |
837b574533c50a36f075ef4825dcf4de
|
|
| BLAKE2b-256 |
78e11ce353aecb86666f97042177b2a9c3980108cbe5d6da27e2db6075300a12
|