from sqlalchemy import text
conn=engine.connect();
s=text("insert into aws_rcsy(topic)values(:topic)");
q_insert=conn.execute(s,topic=topic);
conn.close();
如何取得剛插入資料的id?
ps:q_insert回傳<sqlalchemy.engine.base.ResultProxy object at 0x...>
從q_insert能否取得row資料?
仅有的幸福2017-06-12 09:27:12
複製過來的程式碼,沒有驗證過
rslt_id = conn.execute("INSERT INTO user (name, country_id) VALUES ('Homer', 123)
RETURNING id")
參考 stack-overflow