from tsserver import db
from tsserver.dtutils import datetime_to_str


class Telemetry(db.Model):
    """
    All the data that is going to be obtained in regular time intervals
    (every second or so).
    """

    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime)
    temperature = db.Column(db.Float)
    pressure = db.Column(db.Float)

    def __init__(self, timestamp, temperature, pressure):
        self.timestamp = timestamp
        self.temperature = temperature
        self.pressure = pressure

    def as_dict(self):
        return {'timestamp': datetime_to_str(self.timestamp),
                'temperature': self.temperature,
                'pressure': self.pressure}

from tsserver import db
from tsserver.dtutils import datetime_to_str


class Telemetry(db.Model):
    """
    All the data that is going to be obtained in regular time intervals
    (every second or so).
    """

    timestamp = db.Column(db.DateTime, primary_key=True)
    temperature = db.Column(db.Float)
    pressure = db.Column(db.Float)

    def __init__(self, timestamp, temperature, pressure):
        self.timestamp = timestamp
        self.temperature = temperature
        self.pressure = pressure

    def as_dict(self):
        return {'timestamp': datetime_to_str(self.timestamp),
                'temperature': self.temperature,
                'pressure': self.pressure}

Remove integer ID in Telemetry model
Remove integer ID in Telemetry model

  from tsserver import db
  from tsserver.dtutils import datetime_to_str
  
  
  class Telemetry(db.Model):
      """
      All the data that is going to be obtained in regular time intervals
      (every second or so).
      """
  
-     id = db.Column(db.Integer, primary_key=True)
+     timestamp = db.Column(db.DateTime, primary_key=True)
-     timestamp = db.Column(db.DateTime)
      temperature = db.Column(db.Float)
      pressure = db.Column(db.Float)
  
      def __init__(self, timestamp, temperature, pressure):
          self.timestamp = timestamp
          self.temperature = temperature
          self.pressure = pressure
  
      def as_dict(self):
          return {'timestamp': datetime_to_str(self.timestamp),
                  'temperature': self.temperature,
                  'pressure': self.pressure}
  
Remove integer ID in Telemetry model
## Code Before:
from tsserver import db
from tsserver.dtutils import datetime_to_str


class Telemetry(db.Model):
    """
    All the data that is going to be obtained in regular time intervals
    (every second or so).
    """

    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime)
    temperature = db.Column(db.Float)
    pressure = db.Column(db.Float)

    def __init__(self, timestamp, temperature, pressure):
        self.timestamp = timestamp
        self.temperature = temperature
        self.pressure = pressure

    def as_dict(self):
        return {'timestamp': datetime_to_str(self.timestamp),
                'temperature': self.temperature,
                'pressure': self.pressure}

## Instruction:
Remove integer ID in Telemetry model
## Code After:
from tsserver import db
from tsserver.dtutils import datetime_to_str


class Telemetry(db.Model):
    """
    All the data that is going to be obtained in regular time intervals
    (every second or so).
    """

    timestamp = db.Column(db.DateTime, primary_key=True)
    temperature = db.Column(db.Float)
    pressure = db.Column(db.Float)

    def __init__(self, timestamp, temperature, pressure):
        self.timestamp = timestamp
        self.temperature = temperature
        self.pressure = pressure

    def as_dict(self):
        return {'timestamp': datetime_to_str(self.timestamp),
                'temperature': self.temperature,
                'pressure': self.pressure}
