Skip to content
This repository has been archived by the owner on Aug 9, 2019. It is now read-only.

fmartingr/dataset-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dataset_model

Simple model object to work with the dataset framework

It's available on PyPi:

pip install dataset-model

Basic usage:

from dataset_model.models import Model
import dataset

# Define your model
class Weather(Model):
    _table = 'weather'
    _indexes = ['place', ]
    _fields = [
        ('date', datetime.now()),
        ('temperature', 0),
        ('place', None),
    ]

# Create the engine
engine = dataset.connect('sqlite:///:memory:')

# Create your object and field values
item = Weather(_engine=engine, temperature=32)
item.place = 'Madrid'

# Saves to database
item.save()

# Deletes
item.delete()

About

Simple model object to work with the dataset framework

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages