nanorm


Namenanorm JSON
Version 1.9.14 PyPI version JSON
download
home_pagehttps://github.com/taojy123/nanorm
SummaryA simple ORM framework for Python ( Nano ORM )
upload_time2024-02-01 13:49:43
maintainer
docs_urlNone
authorTao Jiayuan
requires_python
licenseMIT
keywords orm namo mini sample database sqlite nanorm nanoorm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Nanorm : A simple ORM of Python
=========================================


这是一个精简的Python ORM框架。旨在于用一个文件写出ORM,提供开发小型或微型项目时的一些基本功能。


为什么要使用nanorm?
-------------------
当你的项目足够小,以至于不想与其他的多余库产生依赖关系,但是你又需要使用一些简单的ORM功能(SQLAlchemy对你来说过于庞大),这时你就可以选择Nanorm。它只有一个py文件,直接把它放在你的项目目录下就行,你甚至可以把它嵌入在你的源代码中。


为什么只支持sqlite3?
--------------------
这个ORM的目的只在于解决一些小微项目的需求,sqlite3对于小微项目来说是很好的选择。因为在Python标准库中就有对sqlite3的支持,不需要像使用mysql时那样另外安装mysqldb库。另一方面,你也不用在你的电脑或服务器上安装数据库服务,大多数windows和unix的操作系统都自带了sqlite3的支持。我们的目的就是精简,极简。


如何使用?
---------
安装:
```
pip install nanorm
```

下面是一个最简单的例子

```python
from nanorm import *

set_db_name("example.db")

class User(Model):
    name = CharField()
    age = IntegerField(default=20)
    sex = BooleanField()

s1 = User()
s1.name = "Joe"
s1.age = 45
s1.sex = True
s1.save()

joe = User.get(age=45)
print(joe)

```

具体的高级功能和用法可参照 `nanorm_example.py` 文件中各场景的用例





            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/taojy123/nanorm",
    "name": "nanorm",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "orm namo mini sample database sqlite nanorm nanoorm",
    "author": "Tao Jiayuan",
    "author_email": "taojy123@163.com",
    "download_url": "https://files.pythonhosted.org/packages/79/6b/6a7d4e7016de3dfeccca48cb510b5b5d268d5d33148180412b05be202618/nanorm-1.9.14.tar.gz",
    "platform": null,
    "description": "Nanorm : A simple ORM of Python\n=========================================\n\n\n\u8fd9\u662f\u4e00\u4e2a\u7cbe\u7b80\u7684Python ORM\u6846\u67b6\u3002\u65e8\u5728\u4e8e\u7528\u4e00\u4e2a\u6587\u4ef6\u5199\u51faORM\uff0c\u63d0\u4f9b\u5f00\u53d1\u5c0f\u578b\u6216\u5fae\u578b\u9879\u76ee\u65f6\u7684\u4e00\u4e9b\u57fa\u672c\u529f\u80fd\u3002\n\n\n\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528nanorm\uff1f\n-------------------\n\u5f53\u4f60\u7684\u9879\u76ee\u8db3\u591f\u5c0f\uff0c\u4ee5\u81f3\u4e8e\u4e0d\u60f3\u4e0e\u5176\u4ed6\u7684\u591a\u4f59\u5e93\u4ea7\u751f\u4f9d\u8d56\u5173\u7cfb\uff0c\u4f46\u662f\u4f60\u53c8\u9700\u8981\u4f7f\u7528\u4e00\u4e9b\u7b80\u5355\u7684ORM\u529f\u80fd\uff08SQLAlchemy\u5bf9\u4f60\u6765\u8bf4\u8fc7\u4e8e\u5e9e\u5927\uff09\uff0c\u8fd9\u65f6\u4f60\u5c31\u53ef\u4ee5\u9009\u62e9Nanorm\u3002\u5b83\u53ea\u6709\u4e00\u4e2apy\u6587\u4ef6\uff0c\u76f4\u63a5\u628a\u5b83\u653e\u5728\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u4e0b\u5c31\u884c\uff0c\u4f60\u751a\u81f3\u53ef\u4ee5\u628a\u5b83\u5d4c\u5165\u5728\u4f60\u7684\u6e90\u4ee3\u7801\u4e2d\u3002\n\n\n\u4e3a\u4ec0\u4e48\u53ea\u652f\u6301sqlite3\uff1f\n--------------------\n\u8fd9\u4e2aORM\u7684\u76ee\u7684\u53ea\u5728\u4e8e\u89e3\u51b3\u4e00\u4e9b\u5c0f\u5fae\u9879\u76ee\u7684\u9700\u6c42\uff0csqlite3\u5bf9\u4e8e\u5c0f\u5fae\u9879\u76ee\u6765\u8bf4\u662f\u5f88\u597d\u7684\u9009\u62e9\u3002\u56e0\u4e3a\u5728Python\u6807\u51c6\u5e93\u4e2d\u5c31\u6709\u5bf9sqlite3\u7684\u652f\u6301\uff0c\u4e0d\u9700\u8981\u50cf\u4f7f\u7528mysql\u65f6\u90a3\u6837\u53e6\u5916\u5b89\u88c5mysqldb\u5e93\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f60\u4e5f\u4e0d\u7528\u5728\u4f60\u7684\u7535\u8111\u6216\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u6570\u636e\u5e93\u670d\u52a1\uff0c\u5927\u591a\u6570windows\u548cunix\u7684\u64cd\u4f5c\u7cfb\u7edf\u90fd\u81ea\u5e26\u4e86sqlite3\u7684\u652f\u6301\u3002\u6211\u4eec\u7684\u76ee\u7684\u5c31\u662f\u7cbe\u7b80\uff0c\u6781\u7b80\u3002\n\n\n\u5982\u4f55\u4f7f\u7528\uff1f\n---------\n\u5b89\u88c5\uff1a\n```\npip install nanorm\n```\n\n\u4e0b\u9762\u662f\u4e00\u4e2a\u6700\u7b80\u5355\u7684\u4f8b\u5b50\n\n```python\nfrom nanorm import *\n\nset_db_name(\"example.db\")\n\nclass User(Model):\n    name = CharField()\n    age = IntegerField(default=20)\n    sex = BooleanField()\n\ns1 = User()\ns1.name = \"Joe\"\ns1.age = 45\ns1.sex = True\ns1.save()\n\njoe = User.get(age=45)\nprint(joe)\n\n```\n\n\u5177\u4f53\u7684\u9ad8\u7ea7\u529f\u80fd\u548c\u7528\u6cd5\u53ef\u53c2\u7167 `nanorm_example.py` \u6587\u4ef6\u4e2d\u5404\u573a\u666f\u7684\u7528\u4f8b\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple ORM framework for Python ( Nano ORM )",
    "version": "1.9.14",
    "project_urls": {
        "Homepage": "https://github.com/taojy123/nanorm"
    },
    "split_keywords": [
        "orm",
        "namo",
        "mini",
        "sample",
        "database",
        "sqlite",
        "nanorm",
        "nanoorm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "796b6a7d4e7016de3dfeccca48cb510b5b5d268d5d33148180412b05be202618",
                "md5": "755ddff83fe1ea6fd378d92920daaf8c",
                "sha256": "f3ee665ea7a13ff7dc66fd92b59485803803a6e6928ea98cdf4357d1541f68cf"
            },
            "downloads": -1,
            "filename": "nanorm-1.9.14.tar.gz",
            "has_sig": false,
            "md5_digest": "755ddff83fe1ea6fd378d92920daaf8c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7909,
            "upload_time": "2024-02-01T13:49:43",
            "upload_time_iso_8601": "2024-02-01T13:49:43.263275Z",
            "url": "https://files.pythonhosted.org/packages/79/6b/6a7d4e7016de3dfeccca48cb510b5b5d268d5d33148180412b05be202618/nanorm-1.9.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-01 13:49:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "taojy123",
    "github_project": "nanorm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "nanorm"
}
        
Elapsed time: 0.60665s