2
我是一個Python學習者,Python和PostgreSQL - GeomFromText
我試圖插入幾何記錄到PostgreSQL。
如果我嘗試沒有幾何列的查詢,它工作正常,所有數據插入成功。
cur.execute("INSERT INTO taxi (userid,carNum) SELECT '"+str(msg['UserID'])+"',"+str(msg['CarNumber']))
一旦我嘗試添加幾何記錄,什麼都不會發生!執行結束時沒有錯誤,但沒有插入到數據庫中。
cur.execute("INSERT INTO taxi (position,userid,carNum) SELECT GeomFromText('POINT("+str(float(msg['longitude']))+" "+str(float(msg['latitude']))+")',4326),'"+str(msg['UserID'])+"',"+str(msg['CarNumber']))
想不出什麼,我在這裏失蹤