Skip to main content

Easy QuerySet

Django 的 ORM 是我用过最好用的,但无法快速地单独使用,按照官方指示,要写好几行代码。

这个项目只是做了小小的封装,只是为了方便地使用 Django Models 来写脚本。

安装

pip install easy_queryset

示例

from easy_queryset import models, add_mysql
# 数据库配置
add_mysql('localhost', 'username', 'password', 'example_db')
add_mysql('localhost', 'username', 'password', 'example_db', app_label="example")

class Users(models.Model):
    id = models.CharField()
    name = models.CharField()
    email = models.CharField()

    class Meta:
        app_label = "default" # 指定数据库配置
        db_table = "users"


class Group(models.Model):
    id = models.CharField()
    name = models.CharField()
    email = models.CharField()

    class Meta:
        app_label = "example" # 指定数据库配置
        db_table = "group"

Users.objects.all()
Group.objects.all()

Metadata

Release files for easy-queryset 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for easy-queryset 0.0.5
File Size Uploaded
easy_queryset-0.0.5.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for easy-queryset 0.0.5
File Interpreter ABI Platform
easy_queryset-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 6.9 kB

Release files / easy_queryset-0.0.5.tar.gz

Download URL easy_queryset-0.0.5.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e49fe8e2656871352773c80ab993f31711d12cd5cae66dcdb1ef2f8ec7e86958
BLAKE2b-256 checksum
How to use checksums
d4a8022401871470c22a230795947bdfda1d8b5161047b61dd8af0f7416c1b8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.0

Release files / easy_queryset-0.0.5-py3-none-any.whl

Download URL easy_queryset-0.0.5-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d505336020094c615de495f2950c12bf269300d63f06269d85b8507fcd316f8
BLAKE2b-256 checksum
How to use checksums
eae83b17a210419ac2efde0ce7dff9578f4c7014a1004ca206f2eb53eb1b441d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page