3
我不能完全弄清楚這一點:我想從匹配查詢中的表中刪除所有記錄。有點像這樣。python + SQLAlchemy:用會話對象刪除
engine = sqlalchemy.create_engine(string)
meta = MetaData(bind=engine)
meta.reflect(bind=engine, schema='myschema')
Base = automap_base(metadata=meta)
Base.prepare(engine, reflect=True)
Classes = Base.classes
Session = sessionmaker(bind=engine)
session = Session()
session.delete(plays.record_id == '123')
但是,這是行不通的。這裏有什麼想法?錯誤我得到的是:
error in parsing record ID 020087: Class 'sqlalchemy.sql.elements.BinaryExpression' is not mapped
你打電話給session.commit()嗎? – jkysam 2014-10-30 01:50:02