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

Move importer code to psycopg3 #3487

Merged
merged 5 commits into from
Jul 29, 2024
Merged

Conversation

lonvia
Copy link
Member

@lonvia lonvia commented Jul 29, 2024

This resolves the rather odd situation that frontend and backend were depending on different versions of the psycopg library.

The port turned out to be a bigger undertaking than initially planned for. The biggest challenge was moving the indexing code from a select-based approach of waiting for the parallel queries to asyncio-based code. Coroutines are really a beast that is hard to control and getting the code to switch between coroutines at the optimal point in time can be a challenge. But it was worth the effort. The final result is a bit faster than the original code.

The DB helper functions have been moved out of the custom Connection and Cursor classes into freestanding functions. Subclassing Connection and Cursor is not so well supported in psycopg3 anymore.

Indexing now runs multiple times on import if necessary to make sure that all objects are really done.

The other changes are adaptions for the breaking changes in psycopg3. Altogether the version 3 interface feels a lot cleaner. And that is well reflected in the fact that this PR gets rid of a good 500 lines of code.

@lonvia lonvia merged commit 0add25e into osm-search:master Jul 29, 2024
11 checks passed
@lonvia lonvia deleted the port-to-psycopg3 branch July 29, 2024 14:52
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.

1 participant