dual-mode-library
CommunityDual-mode pgdbm libraries: standalone or shared.
Authorjuanre
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This pattern enables building reusable Python libraries that can run standalone with their own database pool or be embedded into a larger application using a shared pool, avoiding code duplication across services.
Core Features & Use Cases
- Accepts either a connection_string or a db_manager to flexibly manage lifecycles in both standalone and embedded modes.
- Always runs migrations into a per-schema namespace to ensure isolation while enabling library reuse.
- Supports clean up; libraries only close connections they created, leaving external pools intact.
- Suited for PyPI distribution or internal tooling where multiple libraries share a single pool or require isolated schemas.
Quick Start
Standalone mode: provide a connection_string and call initialize, then use library methods and finally close. lib = MyLibrary(connection_string="postgresql://localhost/mydb") await lib.initialize()
use lib
await lib.close()
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: dual-mode-library Download link: https://github.com/juanre/pgdbm/archive/main.zip#dual-mode-library Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.