old_contents: # -*- coding: utf-8 -*-
  ## File autogenerated by SQLAutoCode
  ## see http://code.google.com/p/sqlautocode/
  
  from sqlalchemy import *
  from sqlalchemy.databases.mysql import *
  
  metadata = MetaData()
  
  
  Metering =  Table('Metering', metadata,
      Column(u'id', INTEGER(), primary_key=True, nullable=False),
              Column(u'value', FLOAT(), primary_key=False),
              Column(u'date', DATE(), primary_key=False),
              Column(u'sensor_id', INTEGER(), primary_key=False),
      ForeignKeyConstraint([u'sensor_id'], [u'test_dia.Sensor.id'], name=u'metering_fk_Sensor_id'),
      
      )
  Index(u'metering_fk_Sensor_id', Metering.c.sensor_id, unique=False)
  
  
  Sensor =  Table('Sensor', metadata,
      Column(u'id', INTEGER(), primary_key=True, nullable=False),
              Column(u'name', VARCHAR(length=255), primary_key=False),
              Column(u'description', VARCHAR(length=255), primary_key=False),
              Column(u'high_threshold', FLOAT(), primary_key=False),
              Column(u'low_threshold', FLOAT(), primary_key=False),
              Column(u'min_value', FLOAT(), primary_key=False),
              Column(u'max_value', FLOAT(), primary_key=False),
              Column(u'unit', VARCHAR(length=255), primary_key=False),
              Column(u'unit_label', VARCHAR(length=255), primary_key=False),
              Column(u'unique_key', VARCHAR(length=255), primary_key=False),
              Column(u'bus_adress', VARCHAR(length=255), primary_key=False),
      
      
      )
  
  
new_contents: # coding: utf-8
  from sqlalchemy import Column, Date, Float, ForeignKey, Integer, String
  from sqlalchemy.orm import relationship
  from sqlalchemy.ext.declarative import declarative_base
  
  
  Base = declarative_base()
  metadata = Base.metadata
  
  
  class Metering(Base):
      __tablename__ = u'Metering'
  
      id = Column(Integer, primary_key=True)
      value = Column(Float)
      date = Column(Date)
      sensor_id = Column(ForeignKey('Sensor.id'), index=True)
      raw = Column(Integer)
  
      sensor = relationship(u'Sensor')
  
  
  class Sensor(Base):
      __tablename__ = u'Sensor'
  
      id = Column(Integer, primary_key=True)
      name = Column(String(255))
      description = Column(String(255))
      high_threshold = Column(Float)
      low_threshold = Column(Float)
      min_value = Column(Float)
      max_value = Column(Float)
      unit = Column(String(255))
      unit_label = Column(String(255))
      unique_key = Column(String(255))
      bus_adress = Column(String(255))
  
subject: update doc/model.py . The model.py from the app isn't updated, but we need to check some details since there are no connection url in this new moel.py generated with sqlacodegen. The only difference in fact is that we'll need to add two lines: engine = create_engine(...) metadata.bind = engine