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

Delete / Drop .gpkg table / layer #40

Closed
nick4rivers opened this issue Nov 15, 2021 · 1 comment
Closed

Delete / Drop .gpkg table / layer #40

nick4rivers opened this issue Nov 15, 2021 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@nick4rivers
Copy link
Collaborator

Hey @philipbaileynar, @KellyMWhitehead, and @MattReimer

Looking for suggestions on deleting table/layer on disk from a .gpkg from within the plugin? Seems like this may be outside of the pyqgis libraries.

Is this a time I might just move to SQL to DROP the table/layer? I've experimented using the Qt.Sql library which might be the way to go. any insight for your experience on this would be helpful?

@nick4rivers nick4rivers added the help wanted Extra attention is needed label Nov 15, 2021
@nick4rivers nick4rivers self-assigned this Nov 15, 2021
@nick4rivers
Copy link
Collaborator Author

Actually - seems like this simple gdal will work:

gpkg = gdal.OpenEx('/Users/nick/Desktop/My_Test/ProjectLayers.gpkg', gdal.OF_UPDATE, allowed_drivers=['GPKG'])
error = gpkg.DeleteLayer('active_floodplains')
gpkg.ExecuteSQL('VACUUM')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant