Python Phoenixdb connection.commit()无法正常运行

时间:2018-10-25 11:20:59

标签: python phoenix

我正在使用凤凰数据库。

我想将数据插入具有 100 行的表TABLE_A中。

因此,我首先创建了一个连接。

db_url = 'http://hostname:port/'
conn = phoenixdb.connect(db_url, autocommit=False)  # Setting autocommit=False
cursor = conn.cursor()

cursor.execute("UPSERT INTO TABLE_A VALUES (?,?,?,?,?,?)", t1)
conn.commit()  # comitting the db
conn.close()

但是当我跑步时

select count(*) from TABLE_A;

它仍然给我 100

第2部分:

现在,我使用autocommit = True创建了一个新连接。

conn = phoenixdb.connect(db_url, autocommit=True)
cursor = conn.cursor()

cursor.execute("UPSERT INTO TABLE_A VALUES (?,?,?,?,?,?)", t1)
conn.close()

同样,如果我执行select count(*) ...语句,则会得到 101 行。

autommit = False和conn.commit()选项在phoenixdb中不起作用吗?

使用的版本: HBase 2.0.0.3.0.0.0-1634, 凤凰5.0

0 个答案:

没有答案