I have a sqlalchemy class mapping to a database table in MySQL innoDB. The table has several columns and I am able to successfully populate them all except from a TIMESTAMP column:
The mapping:
class HarvestSources(Base):
__table__ = Table('harvested', metadata, autoload=True)
The column on MySQL is a TIMESTAMP which has CURRENT_TIMESTAMP as default value, but when I insert a row it's being filled with NULL.
If default is not working then I need to manually set the timestamp, how could I do either of them.
SqlAlchemy code to insert row to table:
source = HarvestSources()
source.url = url
source.raw_data = data
source.date = ?
DB.session.add(source)
DB.session.commit()