from sqlalchemy import create_engine 执行SQL语句(增删改查均可)

举例:删除一条记录

from sqlalchemy import create_engine

host = '10.x.x.x'
user = 'xxxx'
password = 'xxxxx'
port = 'xxx'
database = 'xxxx'
engine_str = 'postgres://' + user + ':' + password + '@' + host + ':' + port + '/' + database
conn = create_engine(engine_str)
sql = "delete  FROM aaa_test_ma_biao where 序列号='FCQ1544Y4PS'"
conn.execute(sql)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章