Skip to content

Fix get-profile and get-all-sensors when missing link #379

@BenMatase

Description

@BenMatase

For instance, when there is a missing device or a project, the entire endpoint crashes because it tries to make a DB call that looks like

2018-04-17 20:12:36,381 - api - ERROR - Couldn't execute query - b'SELECT * FROM project WHERE projectId IN ()'
Traceback (most recent call last):
  File "/nfs/unixspace/linux/accounts/courtesy/e/energyhill/public_html/Flower/backend/db.py", line 61, in exec_query
    cursor.execute(formatted_sql_string, param_tuple)
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 250, in execute
    self.errorhandler(self, exc, value)
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
    raise errorvalue
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 247, in execute
    res = self._query(query)
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 411, in _query
    rowcount = self._do_query(q)
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/cursors.py", line 374, in _do_query
    db.query(q)
  File "/usr/remote/anaconda-3.6/lib/python3.6/site-packages/MySQLdb/connections.py", line 292, in query
    _mysql.connection.query(self, query)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1")

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions