← Back to list

neon-async-db
by Sobansaud
⭐ 0🍴 0📅 Jan 21, 2026
SKILL.md
name: neon-async-db description: This skill should be used when setting up and managing reliable, high-performance asynchronous database connections for Neon Serverless PostgreSQL using SQLModel and SQLAlchemy's async capabilities.
Neon PostgreSQL Async Connection
This skill providing guidance on setting up and managing reliable asynchronous database connections for Neon Serverless PostgreSQL.
Purpose
Setting up and managing reliable, high-performance asynchronous database connections for Neon Serverless PostgreSQL using SQLModel and SQLAlchemy's async capabilities.
Capabilities
- Environment-aware configuration using
DATABASE_URL. - Creating an asynchronous SQLAlchemy engine using the
asyncpgdriver. - Implementing a
get_async_sessiondependency utilizing proper async context management. - Centralized
Basemetadata management for SQLModel tables. - Connection health check utilities for operational monitoring.
- Serverless-optimized connection pooling configuration.
Implementation Details
Driver & Engine
Ensuring the DATABASE_URL uses the postgresql+asyncpg:// scheme.
from sqlalchemy.ext.asyncio import create_async_engine
from sqlmodel.ext.asyncio.session import AsyncSession
from sqlalchemy.orm import sessionmaker
engine = create_async_engine(DATABASE_URL, echo=False, pool_pre_ping=True)
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
async def get_async_session():
async with async_session() as session:
yield session
Health Check
Implementing a lightweight query to verify connectivity.
async def check_db_health():
async with engine.begin() as conn:
await conn.execute(text("SELECT 1"))
Best Practices
- Using
pool_pre_ping=Trueto handle stale connections commonly found in serverless environments. - Setting
expire_on_commit=Falsein async sessions to allow access to object attributes after a commit. - Always using async context managers (
async with) for sessions to ensure they are properly returned to the pool.
Score
Total Score
40/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon