
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
sb_orm
是一个简单灵活的 Python 库,使用 SQLAlchemy ORM 与 MySQL 数据库进行交互。它提供了一个易于使用的接口,用于执行常见的数据库操作,例如 SELECT
、INSERT
、UPDATE
和 DELETE
。
你可以使用 pip
从 PyPI 安装 sb_orm
:
pip install sb-orm
首先,需要配置数据库连接的环境变量(.env)。确保以下变量已设置:
DB_USER: 数据库用户名
DB_PASSWORD: 数据库密码
DB_HOST: 数据库主机 (例如 localhost)
DB_NAME: 数据库名称
DB_PREFIX: (可选) 表名前缀
from sb_orm import DatabaseSession
db_session = DatabaseSession()
### 查询数据
query = db_session.db('your_table_name').where({'column_name': 'value'}).order_by('id', descending=True).limit(10)
results = query.select()
print(results)
### 插入数据
data = {'column1': 'value1', 'column2': 'value2'}
db_session.db('your_table_name').insert(data)
### 更新数据
query = db_session.db('your_table_name').where({'id': 1})
data = {'column1': 'new_value'}
query.update(data)
### 删除数据
query = db_session.db('your_table_name').where({'id': 1})
query.delete()
import asyncio
from sb_orm import create_task, perform_task, get_task_status
# 示例任务数据
task_data = {
'target_url': 'http://example.com',
'method': 'GET',
'post_body': None,
'header': None,
'frequency': 2, # 每次请求之间的间隔秒数
'times': 3, # 总请求次数
'callback_url': 'http://callback.com'
}
# 创建任务
task = create_task(task_data)
print(f"Created task with ID: {task.id}")
# 执行任务的异步函数
async def run_task(task_id):
await perform_task(task_id)
updated_task = get_task_status(task_id)
print(f"Task ID {task_id} status: {updated_task['status']}")
print(f"Task completed {updated_task['times_completed']} times")
# 运行异步任务
asyncio.run(run_task(task.id))
欢迎贡献!请 fork 仓库并提交 pull request 以进行任何改进或错误修复。
如有任何问题或疑问,请在 GitHub https://github.com/idcim/sb_orm 仓库 上打开 issue。
FAQs
A python stupid mysql orm
We found that sb-orm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.