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

psycopg2.DataError: invalid input syntax for type timestamp: "" #1351

Closed
klonuo opened this issue Jun 18, 2016 · 7 comments
Closed

psycopg2.DataError: invalid input syntax for type timestamp: "" #1351

klonuo opened this issue Jun 18, 2016 · 7 comments

Comments

@klonuo
Copy link

klonuo commented Jun 18, 2016

This happens anytime I add date field in "Select Rows" condition. So it seems like a bad flow, as it happens just by selecting datetime variable, w/o selecting operator and value. After this exception I can select operator and add a value to get filtered data that seem fine.

--------------------------------------------------------------------------------
DataError                                     Traceback (most recent call last):
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\data\owselectrows.py", line 136, in <lambda>
    lambda _: self.set_new_operators(attr_combo, False))
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\data\owselectrows.py", line 170, in set_new_operators
    self.set_new_values(oper_combo, adding_all, selected_values)
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\data\owselectrows.py", line 285, in set_new_values
    self.conditions_changed()
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\data\owselectrows.py", line 329, in conditions_changed
    self.commit()
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\gui.py", line 2183, in unconditional_commit
    do_commit()
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\gui.py", line 2191, in do_commit
    commit()
  File "D:\Python\x32\Python34\lib\site-packages\Orange\widgets\data\owselectrows.py", line 408, in commit
    self.match_desc = report.describe_data_brief(matching_output)
  File "D:\Python\x32\Python34\lib\site-packages\Orange\canvas\report\report.py", line 650, in describe_data_brief
    items["Data instances"] = data.approx_len()
  File "D:\Python\x32\Python34\lib\site-packages\Orange\data\sql\table.py", line 317, in approx_len
    with self._execute_sql_query(sql) as cur:
  File "D:\Python\x32\Python34\lib\contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "D:\Python\x32\Python34\lib\site-packages\Orange\data\sql\table.py", line 711, in _execute_sql_query
    cur.execute(query, param)
psycopg2.DataError: invalid input syntax for type timestamp: ""
LINE 1: ...aba','polutant_NO2','polutant_CO','polutant_PM10') AND "datum" = ''

Using latest Orange 3.3

@lanzagar
Copy link
Contributor

Thank you for reporting this. Currently date fields are mapped to python StringVariable and the default value for that is '' (empty string), but date columns in the database cannot be compared to that.

Orange has received a TimeVariable type recently, which would be the right mapping - so this should be handled much better (and without the error) quite soon.
Until then, you can avoid the annoying error message by unchecking the Send automatically option in Select Rows and making sure that the operator and value are valid before clicking Send manually.

@lanzagar
Copy link
Contributor

lanzagar commented Jul 8, 2016

"quite soon" took a while, but PRs #1424 and #1429 (along with #1430 for similar cases) should fix this.

Please see if it works for you too.

@klonuo
Copy link
Author

klonuo commented Jul 18, 2016

Hi @lanzagar, thanks for your replies

I just tested with latest binary (3.3.6 rev.ee294bc), but the issue still remains - I get exact same error.

@ajdapretnar
Copy link
Contributor

@klonuo 3.3.6 rev.ee294bc is only the official release. The fixes haven't yet been released, so I suggest you to check the very latest version from Github in order to see whether this works. If you don't want to mess with Git, you can wait until Friday, when we'll hopefully going to release version 3.3.7.

@astaric
Copy link
Member

astaric commented Jul 18, 2016

Or try the latest nightly build from http://orange.biolab.si/download/files/nightly/

@klonuo
Copy link
Author

klonuo commented Jul 18, 2016

Thanks guys :)

I don't mind git and compiling, but I use Python 3.5 (not very big difference but still if it's targeted for 3.4...) and installer is very solid from my experience.

Nice to know about nightly builds. However I'll wait for Friday as latest nightly is still too late for those commits referenced.

@ajdapretnar
Copy link
Contributor

Closed via #1424, #1429 and #1430.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants