Feature request #8672
Add an option to modify datasource string on a query layer properties window
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Easy fix?:||No||Copied to github as #:||17400|
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.
- Editing .qgs
I found a workaround here: http://gis.stackexchange.com/questions/62610/changing-data-source-of-layer-in-qgisstackexchange
I must say modifying the string in the .qgs file work like a charm.
And while I will probably do it because it's easier to modify all occurrence of a parameter manually or by script... GUI user will never do that.
- 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 ...
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.
#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 ;)
#1 Updated by Martin HOFFMANN over 9 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.
#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!
#4 Updated by Martin HOFFMANN over 6 years ago
Might be done as of 2.18! Will test ASAP and give feedback