Ticket #1357 (new bug)

Opened 7 months ago

Last modified 6 months ago

Unable to visualize data from SQLite database

Reported by: arnik Owned by:
Milestone: Next 2.x Component: library
Severity: major Keywords: sqlite, scatter plot, parallel coordinates
Cc: Blocking:
Blocked By:

Description

Hello,

I've encountered the following problem with Orange-2.7.2 (OS X 10.7.5) when using the SQLite (v3.x) DB as a data source for visualizing the data in 2D scatterplot (2D) or parallel coordinates (PC). Here is the code snipped I used (for simplicity, the input data is a single tuple (v1,v2)):

from Orange.data.sql import *

db = 'sqlite://sampledb.sqlite'
r = SQLReader()
r.connect(db)
q = "SELECT 1.5 AS v1, 2.5 AS v2 # v1 and v2 are type of 'REAL'"
r.execute(q)
out_data = r.data()
r.disconnect()

Error message for 2D:

Error calling 'handleNewSignals()' of 'Scatter Plot (1)'
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeCanvas/scheme/widgetsscheme.py", line 575, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlot.py", line 280, in handleNewSignals
    self.updateGraph()
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlot.py", line 393, in updateGraph
    self.graph.updateData(self.attrX, self.attrY, self.attrColor, self.attrShape, self.attrSize, self.attrLabel)
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlotGraph.py", line 97, in updateData
    (xVarMin, xVarMax) = self.attrValues[xAttr]
KeyError: ''
unable to set <PyQt4.QtGui.QComboBox object at 0x1127b7d40> to value ''. Possible values are 
unable to set <PyQt4.QtGui.QComboBox object at 0x1127b7ef0> to value ''. Possible values are 
unable to set <PyQt4.QtGui.QComboBox object at 0x1127b7d40> to value ''. Possible values are 
unable to set <PyQt4.QtGui.QComboBox object at 0x1127b7ef0> to value ''. Possible values are 
--------------------------------------------------------------------------------
KeyError                                      Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeCanvas/scheme/widgetsscheme.py", line 575, in process_signals_for_widget
    widget.handleNewSignals()
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlot.py", line 280, in handleNewSignals
    self.updateGraph()
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlot.py", line 393, in updateGraph
    self.graph.updateData(self.attrX, self.attrY, self.attrColor, self.attrShape, self.attrSize, self.attrLabel)
  File "/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/OrangeWidgets/Visualize/OWScatterPlotGraph.py", line 97, in updateData
    (xVarMin, xVarMax) = self.attrValues[xAttr]
KeyError: ''

Error message for CP:

/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/data/preprocess/scaling.py:315: KernelWarning: attribute 'r1' is of unsupported type
  no_jittering_data = full_data.toNumpyMA("ac")[0].T
/Library/Python/2.7/site-packages/Orange-2.7.2-py2.7-macosx-10.7-intel.egg/Orange/data/preprocess/scaling.py:315: KernelWarning: attribute 'r2' is of unsupported type
  no_jittering_data = full_data.toNumpyMA("ac")[0].T

Could you please help? Thanks.

Change History

comment:1 follow-up: ↓ 2 Changed 6 months ago by ales

When reading from and sqlite database all columns are created as strings. This is noted in the  documentation (the note should perhaps be changed to a warning and be displayed more prominently).

comment:2 in reply to: ↑ 1 Changed 6 months ago by arnik

Replying to ales:

When reading from and sqlite database all columns are created as strings. This is noted in the  documentation (the note should perhaps be changed to a warning and be displayed more prominently).

Thank you Ales for pointing out the documentation; however, I wish to know how to make the plot(s) work with the example above. Any suggestions?

Note: See TracTickets for help on using tickets.