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

fix name laundering in export2shp #295

Merged
merged 4 commits into from
Apr 4, 2024

Conversation

MarkusZehner
Copy link
Contributor

Added a dict with shorter names in export2shp, using SQL to rename columns and switched to gdal.VectorTranslate for export. Postgres did not work locally, needs testing

Added a dict with shorter names in export2shp, using SQL to rename columns and switched to gdal.VectorTranslate for export.
Postgres did not work locally, needs testing
@johntruckenbrodt
Copy link
Owner

Thanks @MarkusZehner! This doesn't seem to work with PostgreSQL yet, no idea when I'll get to it.

@MarkusZehner
Copy link
Contributor Author

This is a very strange error, or am i missing something:

FAILED tests/test_drivers.py::test_archive_postgres - RuntimeError: ERROR:  column data.cyclenumber does not exist
LINE 1: ...r SELECT data.acquisition_mode as acq_mode, bbox, data.cycle...
                                                             ^
HINT:  Perhaps you meant to reference the column "data.cycleNumber".

The dict that handles the shorter names has no entry for all-lowercase 'cyclenumber', however the check does append a 'data.' in front, which should only be done for the column names present in the dict. The names for the columns are drawn from the get_colnames, so they should exist in the data table.

Postgres needs names in "Apostrophes" to prevent lowercase
@MarkusZehner
Copy link
Contributor Author

Fixed!

@johntruckenbrodt
Copy link
Owner

Awesome! Thanks a lot @MarkusZehner. I quickly did a little change myself. Should be ready to go now. I'll merge it once the tests are finished.

@johntruckenbrodt johntruckenbrodt merged commit 3f3a240 into johntruckenbrodt:main Apr 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants