psycopg2 を使用して postgresql のテーブルにデータを挿入する際に問題が発生しています。
スクリプトは次のことを行います。
- postgres データベースからデータを照会します
- numpy を使用していくつかの計算を行います
そして、データベース内の別のテーブルに日付を再挿入したいと思います。データを挿入するコードは次のとおりです。
cur.executemany("INSERT INTO water_level_elev (hole_name,measure_date,water_level_elev,rid) VALUES (%s,%s,%s,%s);",[(hole.tolist(),m_date.tolist(),wl.tolist(),rid.tolist(),)])
スクリプトは次のエラーをスローします。
psycopg2.ProgrammingError: column "measure_date" is of type timestamp without time zone but expression is of type timestamp without time zone[]
LINE 1: INSERT INTO water_level_elev (hole_name,measure_date,water_l...
^
HINT: You will need to rewrite or cast the expression.
混乱しています...列「measure_date」と挿入しようとしているデータは同じタイプです。問題は何ですか?????
ありがとう!