Skip to main content

mongodb style python orm.

Project description

torm

mongodb style orm

install

git clone https://github.com/cofepy/torm
cd torm
python setup.py install

or

pip install torm

.env

add .env file to top folder for example:

DBTYPE   = mongo
DB       = test_default

HOST     = 127.0.0.1
PORT     = 27017

CHARSET  = utf8mb4

useage

from torm.model import Model
from torm.field import Str,Int


class Record(Model):
    __tablename__ = 'record'

    hash = Str()
    subject = Str()
    promoter = Str()
    attachments_num = Int()
    mail_id = Str()

    commits = Str()
    group = Str()
    group_hash = Str()
    create_at = Str()
    update_at = Str()
    status = Str()
    tx_status = Str()
    recorder = Str()

# 创建
record = Record({"hash": "0x123", "subject": "test"})
Record.InsertOne(record)

# 单条查询
hash="0x123"
record = Record.FindOne(hash)
record = Record.FindOne(hash=hash)
record = Record.FindOne({'hash':hash})
print(record)
# 批量查询
records = Record.FindMany()
print(records)

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

torm-0.0.1.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distributions

torm-0.0.1-py3.7.egg (219.5 kB view hashes)

Uploaded Source

torm-0.0.1-py2.py3-none-any.whl (57.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

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