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

Port DB Manager Table Management Functionalities to Browser (part 2) #171

Closed
elpaso opened this issue May 7, 2020 · 0 comments
Closed
Labels
Grant-2020 QEP for 2020 Grant program Implemented

Comments

@elpaso
Copy link

elpaso commented May 7, 2020

QGIS Enhancement: Port DB Manager Table Management Functionalities to Browser (part 2)

Date 2020/05/07

Author Alessandro Pasotti (@elpaso), Nyall Dawson (@nyalldawson)

Contact elpaso dot itopen dot it, nyall dot dawson at gmail dot com

maintainer @elpaso

Version QGIS 3.16.0

Summary

With a constantly growing set of data provider supporting the connections API we are now in the position to start the implementation directly in the browser of another group of functionalities that are currently available in DB-Manager, the functionality we intend to port include most of the table management capabilities:

  • creation of new tables
  • creation of new fields
  • removal of existing fields

Motivation

This work is being prompted by:

  1. The desire to provide an alternative to the regressions frequently encountered in the db manager plugin (due mostly to the nature of the Python language and the inherent difficulties in creating stable, regression-free larger projects in Python).

  2. Providing a more unified QGIS experience with database and layer management. Currently we have two completely distinct interfaces for managing databases and tables (db manager and browser). One of the long-term goals for the QGIS project is to remedy this situation by moving the functionality from db manager into the browser panel, so that QGIS offers a single place for users to performance these tasks.

  3. Removal of duplicate code. The db manager plugin uses a lot of code which duplicates code already present in the QGIS c++ libraries. While the db manager code only has a limited test coverage, the c++ versions of this code are extremely well tested and have proved to be regression-free over recent releases. Duplicate code also adds "technical debt" and management burden to the QGIS project.

Creation of new tables

The creation of new table will be available through the context menu of an existing connection from the browser tree.

The dialog will allow to add fields, choose the SRID, geometry type etc.

The new table creation dialog will use the same provider level metadata exposed through QGIS which is currently used when adding new fields to a table. This will provide consistency for the offered field types across the QGIS interface for the different providers. Currently, db manager's "Create Table" functionality uses a duplicate copy of this code which only offers a small subset of the field types possible to create on each provider.

Creation of new fields

The creation of new fields will be available through the context menu of an existing table from the browser tree.

The dialog will allow to add a field.

Removal of existing fields

The removal of fields will be possible through the context menu of an existing table from the browser tree.

The dialog will allow to choose the field to remove (primary key fields and geometry fields will not be available for removal).

A confirmation dialog will ask the user to proceed with the actual removal.

(TBD: support for changing field types or field lengths??)

GUI Considerations

TBD: do we expose fields in the browser tree view (pgadmin style!).

image

Advantages:

  • avoids a double-nested modal dialog ("edit fields" -> "edit field")

Performance Implications

None

Further Considerations/Improvements

(optional)

Backwards Compatibility

None

Issue Tracking ID(s)

None

Votes

(required)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Grant-2020 QEP for 2020 Grant program Implemented
Projects
None yet
Development

No branches or pull requests

2 participants