我想将数据从csv复制到运行以下sql查询的postgress:
DB::statement("\COPY marketo.leads FROM '/home/mark/dw_files/tests/leads.csv' DELIMITER ',' CSV HEADER;");
我得到了错误:
Illuminate \ Database \ QueryException:SQLSTATE [42601]:语法错误:7错误:“ \”或附近的语法错误 第1行:\ COPY从/home/mark/dw_files/tests/leads.cs复制marketo.leads ... ^(SQL:\ COPY marketo.leads from'/home/mark/dw_files/tests/leads.csv'DELIMITER',CSV HEADER;)
由 PDOException:SQLSTATE [42601]:语法错误:7错误:“ \”或附近的语法错误 第1行:\ COPY从/home/mark/dw_files/tests/leads.cs复制marketo.leads ... ^
尽管当我在psql中运行此查询时,它运行正常。