{"id":24520445,"url":"https://github.com/davidho123/streamlit-crud","last_synced_at":"2026-02-27T05:03:48.063Z","repository":{"id":273080919,"uuid":"914468354","full_name":"davidho123/streamlit-crud","owner":"davidho123","description":"Automatically generate UI interfaces and implement CRUD functions","archived":false,"fork":false,"pushed_at":"2025-01-21T02:38:25.000Z","size":208,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-04T06:02:56.849Z","etag":null,"topics":["crud","form","python","streamlit","ui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidho123.png","metadata":{"files":{"readme":"README-zh.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-09T16:51:10.000Z","updated_at":"2025-01-20T09:21:58.000Z","dependencies_parsed_at":"2025-01-18T15:14:26.050Z","dependency_job_id":"fd2febbd-bcf2-4320-bd03-8f2a4ad37bf6","html_url":"https://github.com/davidho123/streamlit-crud","commit_stats":null,"previous_names":["davidho123/streamlit-crud"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidho123/streamlit-crud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidho123%2Fstreamlit-crud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidho123%2Fstreamlit-crud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidho123%2Fstreamlit-crud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidho123%2Fstreamlit-crud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidho123","download_url":"https://codeload.github.com/davidho123/streamlit-crud/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidho123%2Fstreamlit-crud/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29885799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crud","form","python","streamlit","ui"],"created_at":"2025-01-22T02:22:35.169Z","updated_at":"2026-02-27T05:03:48.029Z","avatar_url":"https://github.com/davidho123.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamlit-Crud\n**自动生成ui界面，并实现CRUD功能**\n\n![CRUD主界面](home.png)\\\n![新增表单](creat.png)\\\n![修改表单](modify.png)\n## 目录\n* [概述](README-zh.md##一、概述)\n* [功能](README-zh.md##二、功能)\n* [使用方法](README-zh.md##三、使用方法)\n* [版本说明](README-zh.md##四、版本说明)\n\n## 一、概述\n本模块是一个类，根据数据库模型，自动生成表单组件，和增删改查按钮。\\\n表单提交后，实现数据库的增删改查功能。\n\n## 二、功能\n- 1、根据数据库模型，动态生成表单组件。\\\n   表单组件根据模型的字段类型，动态生成对应的输入组件。\n- 2、生成有增删改查按钮，提交后实现数据库的增删改查功能。\n- 3、数据库以dataframe表格显示，表格配有过滤搜索、分页、下载功能。\n- 4、在根目录下新增log文件夹，以当前日期创建日志文件，记录增删改查信息。\n- 5、默认加载样式修改：设置header高度为1，减少body外边距\n\u003e 备注：新增的表格导出，以本地时间生成文件名。\\\n\u003e streamlit表格的下载，使用UTC时间。所以增加这个导出功能。\n\n## 三、使用方法\n- 1、安装依赖包\n```python\npip install streamlit_crud\npip install streamlit sqlmodel streamlit_antd_components pandas\n```\nui组件生成，使用streamlit\\\n数据库模型，使用的sqlmodel\\\n表格分页功能，使用streamlit_antd_components\\\n表格过滤，使用pandas\n- 2、使用示例\n\n**StreamlitCrud类需要两个参数，第一个参数为数据库模型类，第二个参数为数据库连接地址。**\\\n**运行StreamlitCrud的main方法，就可以生成UI界面和实现CRUD功能。**\n\u003e 备注：\\\n\u003e 1、数据库模型类中，字段名称为\"备注\"时，会使用多行文字组件。\\\n\u003e 2、表单组件的初始值，根据模型字段的default值初始化。\\\n\u003e 3、新增和修改表单时，表单中每一项都是必须填写项，没有填写会提示错误。\\\n\u003e 4、streamlit要设置 wide 模式，否则按钮会挤到一起\nst.set_page_config ( layout=\"wide\" )\n\n```python\nimport streamlit as st\nfrom sqlmodel import SQLModel, Field\nfrom streamlit_crud import StreamlitCrud\nfrom datetime import date, datetime\n\n# 定义数据库模型类\nclass Data(SQLModel, table=True):\n    __tablename__ = \"data\"\n    __table_args__ = {'extend_existing': True}\n    id: int = Field(default=None, primary_key=True,\n                    sa_column_kwargs={\"autoincrement\": True})\n    名称: str = Field(default=\"\")\n    名称: str = Field(default=\"\")\n    价格: float = Field(default=0.0)\n    有货: bool = Field(default=True)\n    录入日期: date = Field(default=date.today())\n    录入时间: str = Field(default=datetime.now().strftime('%H:%M:%S'))\n    备注: str = Field(default=\"无\")  # 备注属性会使用多行文字组件\n\ndatabase_url = \"sqlite:///example.db\"\n# 要选择wide模式，否则按钮会挤到一起\nst.set_page_config(page_title=\"数据管理系统\",  layout=\"wide\")\nstcrud = StreamlitCrud(Data, database_url)\nstcrud.main()\n```\n## 四、版本说明\n\nv 0.1\n提供class模块，实现数据库增删改查功能。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidho123%2Fstreamlit-crud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidho123%2Fstreamlit-crud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidho123%2Fstreamlit-crud/lists"}