python - Trying to understand UnmappedInstanceError using SQLAlchemy -
i'm trying fill table in sql data in dataframe below. code functions expected when use other dataframes same columns , datatypes, dataframe alone error sqlalchemy.orm.exc.unmappedinstanceerror: class 'builtins.list' not mapped
results line session.add([yc_node_hist(fk_yc_update = listofindices3[i],curve_date = row1['date'], tenor = row1['year'], abrv = row1['value'])])
. using automap()
map table yc_node_hist
class. my main problem can't understand error means.
date year value abbrv 0 2005-01-04 0.08333333 4.709456 gbp 1 2005-01-05 0.08333333 4.713099 gbp 2 2005-01-06 0.08333333 4.707237 gbp 3 2005-01-07 0.08333333 4.705043 gbp
yc_node_hist
:
create table yc_node_hist ( id bigint identity(1,1) primary key, fk_yc_update bigint not null foreign key references yc_update(id), curve_date date not null, tenor float not null, abrv float not null )
the code using:
engine2 = yielddata.connectionengine() session = session(bind=engine, expire_on_commit=false) (i1, row1), (i2, row2) in pairwise(df.iterrows()): if row1['abbrv'] == row2['abbrv'] , isinstance(row1['value'], float)==1: print(row1) session.add([yc_node_hist(fk_yc_update = listofindices3[i],curve_date = row1['date'], tenor = row1['year'], abrv = row1['value'])])
Comments
Post a Comment