restapiservice-rj0rho/app/initial_data.py
Automated Action f207cc3c64 Create RESTful API service with FastAPI and SQLite
- Set up project structure with FastAPI and dependency files
- Configure SQLAlchemy with SQLite database
- Implement user authentication using JWT tokens
- Create comprehensive API routes for user management
- Add health check endpoint for application monitoring
- Set up Alembic for database migrations
- Add detailed documentation in README.md
2025-06-16 14:56:03 +00:00

33 lines
610 B
Python

import logging
from app.db.init_db import init_db
from app.db.session import SessionLocal
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def init() -> None:
"""
Initialize the database with initial data.
"""
db = SessionLocal()
try:
init_db(db)
logger.info("Initial data created")
finally:
db.close()
def main() -> None:
"""
Main function to initialize the database.
"""
logger.info("Creating initial data")
init()
logger.info("Initial data creation completed")
if __name__ == "__main__":
main()