Feature request #3139

[Patch] Custom query for the spatialite provider

Added by Giuseppe Sucameli over 13 years ago. Updated about 13 years ago.

Status:Closed
Priority:Low
Assignee:Sandro Furieri
Category:Data Provider
Pull Request or Patch supplied: Resolution:fixed
Easy fix?:No Copied to github as #:13199

Description

This patch enhances the spatialite provider capabilities allowing users to load a spatialite layer using a custom query (as the one previously developed for the postgres provider).

patch_for_ticket_3139.diff Magnifier - patch (14.3 KB) Giuseppe Sucameli, 2010-10-20 04:21 AM

History

#1 Updated by Sandro Furieri over 13 years ago

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

I've applied the patch suggested by brushtyler
Committed in r.14435

#2 Updated by Luiz Motta about 13 years ago

  • Resolution deleted (fixed)
  • Status changed from Closed to Feedback

When in select statement have only the pkuid's column, the attributes's table didn't showed the values of pkuid.
Obs: The identify is OK. The problem is the table of layer
Otherwise (have others columns) all attributes showed in table

Example with error(only pkuid):
sql = "select t.id as pkuid,t.the_geom as geometry from test t limit 10"
uri = QgsDataSourceURI()
uri.setDatabase('/home/lmotta/bd_gis/spatialite/gis.sqlite')
uri.setDataSource(_, '(%s)' % sql, 'geometry', _, 'pkuid')
qgis.utils.iface.addVectorLayer(uri.uri(), "Select", 'spatialite')

Example correct (more columns):
sql = "select t.id as pkuid, t.name, t.the_geom as geometry from test t limit 10"
...

#3 Updated by Giuseppe Sucameli about 13 years ago

The one you talk about it's a bug.
Why did you re-open a closed patch ticket about a different problem?

Indeed the patch improved QGis adding a missing feature.
You should open a proper ticket, a bug ticket.

#4 Updated by Giuseppe Sucameli about 13 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

Replying to [comment:4 brushtyler]:

Replying to [comment:3 lmotta]:

When in select statement have only the pkuid's column, the attributes's table didn't showed the values of pkuid.

Why did you re-open a closed patch ticket about a different problem?
You should open a proper ticket, a bug ticket.

I close this ticket. See #3356, the ticket related to the bug you had reported.

#5 Updated by Luiz Motta about 13 years ago

Sorry reopen this ticket and thanks, twice, explained how make ticket about bug in this feature and make the fix the ticket 3356

Also available in: Atom PDF