-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Show dialog when importing tables via browser, give users options to control import #60875
Conversation
…erDestinationUri Creates a URI for use with QgsVectorLayerExporter corresponding to given destination table options for the backend. The URI format and extra options which need to be passed to QgsVectorLayerExporter differ from provider to provider, so this new method gives us a consistent, generic method we can call to safely generate the right URI and options in a cross-provider way. Implemented for all database connection providers.
Create QgsDataItemGuiProviderUtils::handleDropUriForConnection, which handles single vector item drop on a database provider connection item for ALL database providers in a consistent way. This first shows QgsDbImportVectorLayerDialog allowing the user to customise the imported table details, and then runs the export in a background task.
…e, import capabilities
Currently supported for Postgres provider only
To accompany the existing drag-and-drop support for layers, this action just directly opens the Import Layer dialog and allows users to import one of the layers from the current project to a destination db/schema
🪟 Windows buildsDownload Windows builds of this PR for testing. 🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. |
Looks great @nyalldawson . Seems to handle all the cases 👍 |
Unrelated test failure |
@nyalldawson A documentation ticket will be opened at https://github.com/qgis/QGIS-Documentation when this PR is merged. Please update the description (not the comments) with helpful description and screenshot to help the work from documentors. Thank you! |
@nyalldawson |
This PR is a step towards porting the DB Manager "Import vector table" functionality into core/browser. I've taken extreme care here to ensure that everything is kept generic and that the GUI is all dynamically built based on the available capabilities of the destination database provider. This means that we gain native import vector table control for postgres, hana, sql server, gpkg, spatialite + the OGR database formats (eg ESRI File Geodatabase) in one shot, and that any future extensions to this dialog will automatically apply to all relevant destination providers. *
To facilitate this, I've added new API to the database connections classes. I've removed a lot of duplicate copy/paste code from the various QgsDataItemGuiProvider subclasses and moved them to generic methods in QgsDataItemGuiProviderUtils.
Some notes:
Sponsored by City of Canning
Fixes #24194