Skip to content

Commit

Permalink
Revert back to copy_expert
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed May 6, 2024
1 parent 38421c8 commit 97e8d7d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions ckanext/datapusher_plus/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,6 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None):
copied_count = 0
try:
raw_connection = psycopg2.connect(tk.config.get("ckan.datastore.write_url"))
connection_string = tk.config.get("ckan.datastore.write_url")
except psycopg2.Error as e:
raise utils.JobError("Could not connect to the Datastore: {}".format(e))
else:
Expand Down Expand Up @@ -1386,16 +1385,7 @@ def _push_to_datastore(task_id, input, dry_run=False, temp_dir=None):
)
with open(tmp, "rb") as f:
try:
# cur.copy_expert(copy_sql, f)
subprocess.run(
[
"psql",
"-Atx",
connection_string,
"-c",
f"COPY '{resource_id}' FROM \'" + tmp + "' CSV HEADER",
],
)
cur.copy_expert(copy_sql, f)
except psycopg2.Error as e:
raise utils.JobError("Postgres COPY failed: {}".format(e))
else:
Expand Down

0 comments on commit 97e8d7d

Please sign in to comment.