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

Open a single db transaction for a single operation #281

Merged
merged 1 commit into from
Dec 2, 2020
Merged

Conversation

olsen232
Copy link
Collaborator

Description

Went through all the functions in the working copies and made sure they don't open more than one transaction in a sequence, or call more than one function in a sequence that would result in opening more than one transaction in a sequence.

This can mostly be easily fixed by opening a transaction that is reused, and that contains all the functions called. Any transactions that those functions open will reuse the one ongoing transaction.

A couple of things needed changing -

  • we can't switch database engine mid-transaction to create the spatial index using gdal. Luckily, it seems like reusing the apsw engine works? Is there a downside?
  • Rearranged some DELETEs so they didn't need PRAGMA defer_foreign_keys

@rcoup
Copy link
Member

rcoup commented Oct 21, 2020

So I think we're effectively swapping from GDALs spatial index to Spatialite's here.

I want to dig in to figure out what that actually means in practice wrt differences.

@olsen232
Copy link
Collaborator Author

... can we use the GDAL engine everywhere??

No idea how this ties in with sqlalchemy as and when we get that working

@olsen232
Copy link
Collaborator Author

@rcoup is this something you are still looking into?

@rcoup
Copy link
Member

rcoup commented Nov 30, 2020

AFAICS GDAL GPKG Spatial Index code and the Spatialite equivalent basically seem to do the same thing. Which I guess is because it's defined as an official GPKG extension.

👍

@olsen232 olsen232 force-pushed the transactions branch 2 times, most recently from 699fd55 to d57ed5e Compare December 2, 2020 03:01
@olsen232 olsen232 merged commit e34fb0e into master Dec 2, 2020
@olsen232 olsen232 deleted the transactions branch December 2, 2020 06:11
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