PostgreSQL: psycopg2.errors.SyntaxError: syntax error at or near "INSERT"
Есть у меня такой запрос:
WITH temp AS (SELECT id, number, name, connect_project_id, description, type, status, path, language, country, timezone, created, modified
FROM source.table
WHERE target.table.collect_project_id != source.table.projects.id
AND (source.table.projects.created > getdate() - interval '30 minutes' OR source.table.projects.modified > getdate() - interval '30 minutes'))
INSERT INTO target.table (
collect_project_id,
project_number,
project_name,
connect_project_id,
project_desc,
project_type,
project_status,
project_path,
language_code,
country_code,
timezone,
date_created,
date_updated
)
SELECT
id,
number,
name,
connect_project_id,
description,
type,
status,
path,
language,
country,
timezone,
created,
modified
FROM temp;
Но что-то ругается на него интерпретатор, но я в упор не могу понять где ошибся...