1
私は構造以下挿入psycopg2を使ってpostgresのテーブルにCSVファイルからのデータとのpython 3.4
CREATE TABLE edmonton.permit
(permit_date text,
permit_number text,
year numeric,
month_number integer,
report_permit_date text,
job_category text,
address text,
legal_description text,
neighbourhood text,
neighbourhood_number text,
job_description text,
building_type text,
work_type text,
floor_area numeric,
construction_value integer,
zoning text,
units_added numeric,
latitude double precision,
longitude double precision,
location text,
count integer
とpostgresのテーブルを持っています
with open(file) as f:
reader = csv.reader(f, delimiter=',')
next(reader, None)
for row in reader:
cur.execute("INSERT INTO edmonton.{}(permit_date, permit_number, year, month_number, report_permit_date, job_category, address, legal_description, neighbourhood, neighbourhood_number, job_description, building_type, work_type, floor_area, construction_value, zoning, units_added, latitude, longitude, location, count) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)".format(permit),row)
con.commit()
私は以下のエラーを取得しています
Invalid literals for numeric datatype.
保有者はどうあるべきかの場所数値、整数、倍精度のpython3.4を使用していますか?
Psycopgのすべてのプレースホルダーは「%s」です。 csvを表示する必要があります。 –