2

When I right-click on a selected SQL query and choose "Format SQL" it changes the SQL to lower case.

The other command "To upper case" is not SQL-intelligent, meaning it changes everything in the selection to upper case, therefore it is also not called with "SQL" in the name.

enter image description here

The query itself is not case sensitive and runs through in SQL with a global change to upper or lower case, but an external Python function that uses the results of the SQL query cannot find the needed column anymore when it is made upper-case since it searches for a column_name in lower case.

This led to the following error in my frontend:


AttributeError

AttributeError: 'Source' object has no attribute 'schedule_day' Traceback (most recent call last)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app

response = self.make_response(self.handle_exception(e))

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/monitoring/app.py", line 149, in show_broken_sources

if source.schedule_day is None:

AttributeError: 'Source' object has no attribute 'item_day'

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame
dump(obj) dumps all that's known about the object

Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.

Is there a way to make the change to upper case only for the SQL command words, at best by default?

questionto42
  • 2,691

1 Answers1

3

Go to File --> Properties --> Editors --> SQL Editor --> Formatting. You can even choose the settings of the data source, the global settings, or external settings.

enter image description here

In my case, in the "Default Formatter", choose "Upper", and you can use this formatter using Ctrl+Shift+F

questionto42
  • 2,691