mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

dissapearing settings #82

Closed abuckenheimer closed 7 years ago

abuckenheimer commented 7 years ago

Getting the following traceback trying to select a connection.

Traceback (most recent call last):
  File "C:\Users\abuckenheimer\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 225, in <lambda>
    Window().show_quick_panel(menu, lambda index: ST.setConnection(index, tablesCallback, columnsCallback, functionsCallback))
  File "C:\Users\abuckenheimer\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 210, in setConnection
    ST.loadConnectionData(tablesCallback, columnsCallback, functionsCallback)
  File "C:\Users\abuckenheimer\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 197, in loadConnectionData
    ST.conn.getTables(tbCallback)
  File "C:\Users\abuckenheimer\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLToolsAPI\Connection.py", line 63, in getTables
    query = self.getOptionsForSgdbCli()['queries']['desc']['query']
  File "C:\Users\abuckenheimer\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLToolsAPI\Connection.py", line 176, in getOptionsForSgdbCli
    return self.settings.get('cli_options', {}).get(self.type)
AttributeError: 'NoneType' object has no attribute 'get'

I just upgraded to sublime build 3128 so its quite possibly related to that.

I followed the settings through the code and I could see them being set in SQLTools@startPlugin(), and then being passed in at SQLToolsAPI.Connection@init. But something must happen to them inbetween initialization and getOptionsForSgdbCli. Passing the "items" attribute of a Settings object seems fishy to me but I'm not sure.

tkopets commented 7 years ago

The problem is that SQLTools cannot find your DB cli binary (mysql, psql, sqlite etc) in PATH. Either add your DB cli binaries to PATH or set the full path to you cli binary. Example cli section from SQLTools.sublime-settings below:

    "cli" : {
        "mysql"   : "c:/Program Files/MySQL/MySQL Server 5.7/bin/mysql.exe" ,
    }

The correct messaging will be available in next release.

abuckenheimer commented 7 years ago

@tkopets latest version worked with me, many thanks!

tkopets commented 7 years ago

@abuckenheimer You are using the latest version from master branch or from PackageControl? You have modified your cli section in settings, or it just started to work fine without any intervention?

abuckenheimer commented 7 years ago

Sorry should have been more clear, I manually installed the latest version from master and was able to track down the settings issue.