mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Configure Ruff as the code formatter and linter with pre-commit hooks. Applied automatic formatting fixes across the entire codebase including: - Import sorting and organization - Code style consistency (spacing, line breaks, indentation) - String quote normalization - Removal of trailing whitespace and unnecessary blank lines
17 lines
504 B
Python
17 lines
504 B
Python
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
|
|
|
|
from meshview import models
|
|
|
|
|
|
def init_database(database_connection_string):
|
|
global engine, async_session
|
|
engine = create_async_engine(
|
|
database_connection_string, echo=False, connect_args={"timeout": 900}
|
|
)
|
|
async_session = async_sessionmaker(engine, expire_on_commit=False)
|
|
|
|
|
|
async def create_tables():
|
|
async with engine.begin() as conn:
|
|
await conn.run_sync(models.Base.metadata.create_all)
|