"""train model""" import streamlit as st def create_table(conn): with conn.session as s: s.execute('CREATE TABLE IF NOT EXISTS train (position TEXT, trial_num INTEGER, start_time DATETIME, owner_name TEXT);') s.commit() def get_trains(conn, sub_name): trains = conn.query('select * from train where owner_name = :owner', ttl=0.05, params={'owner': sub_name}) return trains def create_train(conn, train_form): with conn.session as s: s.execute( 'INSERT INTO train (position, trial_num, start_time, owner_name) VALUES (:position, :trial_num, :start_time, :owner_name);', params=dict(position=train_form['position'], trial_num=train_form['trial_num'], start_time=train_form['start_time'], owner_name=train_form['owner_name']) ) s.commit()