Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load_csv_to_postgres_via_copy considers _id and _full_text #14

Open
hannelita opened this issue Jun 11, 2020 · 3 comments
Open

load_csv_to_postgres_via_copy considers _id and _full_text #14

hannelita opened this issue Jun 11, 2020 · 3 comments
Labels
bug Something isn't working frozen

Comments

@hannelita
Copy link
Contributor

The task load_csv_to_postgres_via_copy considers these two fields when trying to fit the CSV into the table. Find a solution that allows a clean CSV load

@hannelita hannelita added the bug Something isn't working label Jun 11, 2020
@hannelita
Copy link
Contributor Author

Xloader will have other methods to handle these two fields https://github.com/ckan/ckanext-xloader/blob/master/ckanext/xloader/loader.py , see https://github.com/ckan/ckanext-xloader/blob/master/ckanext/xloader/loader.py#L496.

We will probably need something similar to tackle this issue @rufuspollock

@hannelita
Copy link
Contributor Author

I tried a workaround which did not work: create a temporary table, export csv to temporary table and insert the contents of the temp. table into the resource table. It did not work because there is a trigger for the _full_text field:

create temporary table t (x1 integer, ... , x10 text)
COPY t (x1, ... , x10) from '/path/to/my_file' with (format csv)


insert into my_table (x2, x5, x7, x10)
select x2, x5, x7, x10
from t



drop table t

(source: https://stackoverflow.com/questions/12618232/copy-a-few-of-the-columns-of-a-csv-file-into-a-table)

@hannelita
Copy link
Contributor Author

Freezing that for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working frozen
Projects
None yet
Development

No branches or pull requests

1 participant