Feature request #8672

Add an option to modify datasource string on a query layer properties window

Added by Martin HOFFMANN about 11 years ago. Updated about 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Vectors
Pull Request or Patch supplied:No Resolution:fixed/implemented
Easy fix?:No Copied to github as #:17400

Description

Context

To create statistical map I often use read only postgis query that involve server side computations and custom functions.
So it's critical for me to send a custom SQL string but which return a nice table with gid and geometry.

Creating those kind of layer using DB manager is fairly easy.
However once create I can see the custom data-source string in "layer properties" Windows but there is no way I can edit it through the GUI.

This pretty annoying because one would be tempted to modify a parameter in the original query while keeping all the others layers properties untouched.
A practical case use would be modifying a date parameter in the WHERE clause to display a different time-frame.

Sometimes computing the query for all available dates and filtering later on in QGIS is simply not an option for performance sake.

Already mentioned Workarounds

  • Use ArcGis 10 instead
    That's for the joke. But actually ArcGis 10 enable user to modify the query of a PostGis query layer.
    My office still heavily rely on this software, let me tell you I was quite shocked to see it has got a PostGis related feature that lacks in QGIS 2.0 ...

Envisaged fix

As this could broke some functionality or generate weird errors if badly understood, I think we might implement this as a new option setting.
In "Settings>Option>Data sources>Data source Handling" we can put a new check-box like this:

"Enable datasource string edition in the layer properties windows"

Of course the most complicated part will be to trigger the appropriate validation of the user defined new string and error handling when this field is edited.
Maybe a first approach would be to reject the new string if any new error is generated upon validation and fallback to the old data-source string.

Related issue(s) that might be fixed
#8164 Can't fix bad datasource info in qgs file through GUI
(will do a search for similar cases for tommorow)

And lastly, Sorry for my english, I'm French ;)

Best Regards


Related issues

Related to QGIS Application - Feature request #8164: Can't fix bad datasource info in qgs file through GUI Open 2013-06-25
Related to QGIS Application - Bug report #13170: postgis layer.dataProvider().setDataSourceURI(.....) has... Closed 2015-07-29

History

#1 Updated by Martin HOFFMANN about 11 years ago

I omitted yesterday to explain that I use DBManager to create those custom query table.
So this feature could as well be integrated as a part of DBManager if you think it's more appropriate.

*Related tickets and threads*+
On stacks-exchange : http://gis.stackexchange.com/questions/6157/in-qgis-is-it-possible-to-edit-the-datasource-of-a-postgis-layer

#3337 Query Builder's data sampler doesn't use original dataset
(This only half-related because this apply to "layer level query" while I propose "data-source level query" should be editable as well)

Should I investigate further and provide a screen-cast for this feature?
I'm not a developer so I know that while this look pretty easy from my point of view, Qgis internals can make this difficult.
Don't hesitate to tell me your thoughts!

#2 Updated by Giovanni Manghi about 11 years ago

  • Target version changed from Version 2.0.0 to Future Release - Nice to have
  • Category changed from GUI to Vectors

#3 Updated by Olivier Dalang over 10 years ago

Hi !

I also miss this feature very much. But why limit it to query layers ? The same can be useful for plain old shapefiles as well...

Thanks !

#5 Updated by Martin HOFFMANN about 8 years ago

Please close this as for me it's now totally implemented by the new feature of 2.18 Las Palmas.
(http://changelog.qgis.org/en/qgis/version/2.18.0/#db-manager-add-ability-to-update-sql-layer)

Great thanks to the developers 3Liz and the sponsor Ifremer.

#6 Updated by Saber Razmjooei about 8 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Also available in: Atom PDF