A command-line tool for introspecting database schemas and generating documentation.
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
The tool currently supports the following commands:
python main.py introspect --conn <connection_string> [options]Options:
--conn: Database connection string (required)- Format:
postgresql://user:pass@localhost:5432/mydb
- Format:
--schema: Database schema to introspect (default: 'public')--format: Output format (default: 'json')--output-dir: Directory to store output files (default: 'output')
Example:
python main.py introspect --conn postgresql://postgres:postgres@localhost:5432/nestjs --schema public --output-dir ./outputTo see all available commands:
python main.py --helpTo check the version:
python main.py --versionThe test suite requires a PostgreSQL database. Configure the following environment variables or update the test constants in tests/test_introspect.py:
POSTGRES_HOST = "localhost"
POSTGRES_PORT = 5432
POSTGRES_USER = "postgres"
POSTGRES_PASSWORD = "postgres"
POSTGRES_NAME = "nestjs"To run tests:
pytestThe test suite includes:
- Basic schema introspection
- Empty schema handling
- Invalid schema handling
- Complex schema with relationships
- Connection error handling
project_root/
|-- src/ # Application source code
|-- tests/ # Test suite
|-- main.py # CLI entry point
|-- requirements.txt # Dependencies