github / github/codespaces-jupyter
screen
- 主要语言
- Jupyter Notebook
- 星标
- 894
- 派生
- 1.7k
- PR 合并指标
- 30 天内没有已合并 PR
描述
import mysql.connector
from contextlib import contextmanager
DB_CONFIG = {
"host": "localhost",
"user": "root",
"password": "",
"database": "School_Fees_DB"
}
@contextmanager
def get_db():
conn = mysql.connector.connect(**DB_CONFIG)
cursor = conn.cursor(dictionary=True)
try:
yield cursor
conn.commit()
except Exception as e:
conn.rollback()
raise e
finally:
cursor.close()
conn.close()
贡献指南
调研方向
The issue contains only a code snippet and does not identify a repository file, test, failing behavior, or requested change. Clarify the intended outcome and provide reproduction steps before selecting an entry point or defining what done means.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- mysql, python
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 5/100