custom ORM
Project description
inf_0008_custom_orm - Team 1
Установка:
pip install custom-orm
Пример использования:
from datetime import datetime
from custom-orm import db
class User(db.Model):
table_name = 'asdfasdf'
id = db.IntegerField(primary_key=True, auto_increment=True)
name = db.StringField(max_length=255)
surname = db.StringField(max_length=255)
age = db.IntegerField(name_in_db='my_age')
birth = db.DateTimeField()
is_agent_007 = db.BooleanField()
# You can get User instance by creating database entry
u = User(name='Ruslan', surname='Gazizov', age=18, is_agent_007=True,
birth=datetime(year=2003, month=1, day=21))
# Or by finding it in database
u = User.where(name='Ruslan', my_age=18)
# Directly change the properties without saving
u.name = 'Другое имя'
u.surname = 'Другая фамилия'
u.age = '22'
u.birth = datetime(year=2021, month=11, day=27)
u.is_agent_007 = False
# Save changes
u.save()
# Delete database entry
User.delete(primary_key_value=u.id)
User.save()
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
custom_orm-0.5.tar.gz
(4.2 kB
view details)
File details
Details for the file custom_orm-0.5.tar.gz
.
File metadata
- Download URL: custom_orm-0.5.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cbda3140c0b87750fae080acb00c79d2026f7b44ae4e13533a8ceadf0a370a5 |
|
MD5 | 7b5538acef376f0d9de97c4818199aa2 |
|
BLAKE2b-256 | 8090fe2e69b9e5c6bd4d09bb4d18e8136ac068de7e02f7eee6b96b07d4eab2e7 |