def add_book(d): d['created'] = datetime.now().isoformat() d['lastmodified'] = datetime.now().isoformat() psql = Postgres() psql.connect('NCTI_Lib') err = psql.execute(psql.create_insert_sql(d, 'book')) if err: print(err) else: print("Insert Success")
def add_bus_data(d): d['created'] = datetime.now().isoformat() if d['OnOff'] == "ON": d['OnOff'] = "1" else: d['OnOff'] = "0" if not d['Lat']: d['Lat'] = 0 if not d['Lng']: d['Lng'] = 0 psql = Postgres() psql.connect('bus') err = psql.execute(psql.create_insert_sql(d, 'raw')) if err: print(err) else: print("Insert Success") psql.disconnect()