cli¶
- advanced_alchemy.cli.add_migration_commands(database_group=None)[source]¶
Add migration commands to the database group.
- Parameters:
- Raises:
MissingDependencyError – If the click package is not installed.
- Return type:
- Returns:
The database group with the migration commands added.
- advanced_alchemy.cli.get_alchemy_group()[source]¶
Get the Advanced Alchemy CLI group.
- Raises:
MissingDependencyError – If the click package is not installed.
- Return type:
- Returns:
The Advanced Alchemy CLI group.
Overview¶
The CLI module provides Click-based command groups for database migrations and management. Can be used standalone or integrated into framework CLIs (Litestar, FastAPI, Flask).
Functions¶
- advanced_alchemy.cli.get_alchemy_group()[source]
Get the Advanced Alchemy CLI group.
- Raises:
MissingDependencyError – If the click package is not installed.
- Return type:
- Returns:
The Advanced Alchemy CLI group.
- advanced_alchemy.cli.add_migration_commands(database_group=None)[source]
Add migration commands to the database group.
Usage¶
Standalone CLI:
from advanced_alchemy.cli import get_alchemy_group
cli = get_alchemy_group()
if __name__ == "__main__":
cli()
Framework Integration:
from advanced_alchemy.cli import add_migration_commands
from click import Group
app_cli = Group("myapp")
add_migration_commands(app_cli)