File: models.py

package info (click to toggle)
python-django-timescaledb 0.2.13-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 304 kB
  • sloc: python: 512; sh: 20; makefile: 6; sql: 4
file content (22 lines) | stat: -rw-r--r-- 599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from django.db import models
from timescale.db.models.fields import TimescaleDateTimeField
from typing import Dict

from timescale.db.models.models import TimescaleModel
from timescale.db.models.managers import TimescaleManager




# Create your models here.
class Metric(models.Model):
    time = TimescaleDateTimeField(interval="1 day")
    temperature = models.FloatField(default=0.0)
    device = models.IntegerField(default=0)

    objects = models.Manager()
    timescale = TimescaleManager()


class AnotherMetricFromTimeScaleModel(TimescaleModel):
    value = models.FloatField(default=0.0)