Skip to main content

django queryset for script

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_queryset-0.0.5.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_queryset-0.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file easy_queryset-0.0.5.tar.gz.

File metadata

  • Download URL: easy_queryset-0.0.5.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for easy_queryset-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e49fe8e2656871352773c80ab993f31711d12cd5cae66dcdb1ef2f8ec7e86958
MD5 58adf1006142306281a20f0d88d67265
BLAKE2b-256 d4a8022401871470c22a230795947bdfda1d8b5161047b61dd8af0f7416c1b8a

See more details on using hashes here.

File details

Details for the file easy_queryset-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: easy_queryset-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for easy_queryset-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6d505336020094c615de495f2950c12bf269300d63f06269d85b8507fcd316f8
MD5 2b5b6e302631b5e58dc801522ae571b4
BLAKE2b-256 eae83b17a210419ac2efde0ce7dff9578f4c7014a1004ca206f2eb53eb1b441d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page