I am using SQLALCHEMY to import some some data from spreadsheets into a sqlite database. I define the tables using a declaritive base with the
import sqlalchemy as sdb
import sqlalchemy.ext.declarative as sed
Base = sed.declarative_base()
class Volume(Base):
__tablename__ = 'volumes'
current_node = sdb.Column(sdb.Integer, primary_key=True)
relation_to_last = sdb.Column(sdb.Integer, nullable=False)
last_node = sdb.Column(sdb.Integer, nullable=False)
rotation = sdb.Column(sdb.Integer)
cross_st_name = sdb.Column(sdb.String)
through_st_name = sdb.Column(sdb.String)
from_west = sdb.Column(ArrayType())
from_north = sdb.Column(ArrayType())
from_east = sdb.Column(ArrayType())
from_south = sdb.Column(ArrayType())
am_peak_factor = sdb.Column(sdb.Integer)
pm_peak_factor = sdb.Column(sdb.Integer)
am_peak_hour = sdb.Column(ArrayType())
pm_peak_hour = sdb.Column(ArrayType())
__table_args__ = tuple(sdb.UniqueConstraint(relation_to_last, last_node))
Yet when I test this and put a string where an integer should be the 'string' is read into the database (see below). I thought this would have thrown an error. Is there something wrong with the way I defined the table or is there not enough information here to answer my question?