python - Unable to insert from sqlalchemy to mysql -


i'm trying insert row table of mysql db sql alchemy, when insert , go database check data, see nothing.

this code:

from sqlalchemy import create_engine sqlalchemy import table, metadata sqlalchemy.sql import table, column, select, update, insert sqlalchemy.orm import sessionmaker

engine = create_engine(       "mysql://user:password@host/schema") connection = engine.connect()  metadata = metadata(bind=engine) prices = table('historical_prices', metadata, autoload=true) = insert(prices) = i.values({     "date": my_date,      "instrument": msg['instrument'],     "open": msg['candles'][0]['openask'],     "high": msg['candles'][0]['highask'],     "low": msg['candles'][0]['lowask'],     "close": msg['candles'][0]['closeask'],     "volume": msg['candles'][0]['volume']     }) session = sessionmaker(bind=engine) session = session() session.execute(i) 

i receive no error message code. how can fix this?


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -