Closed cndab closed 6 years ago
There might be several problems.
ST: Describe Table
.;
is missingDid you have any errors in Sublime Text console (Ctrl+or select
View → Show Console`)?
I think I did have some errors. I have attached the console output. Its referring to connection.py. My test query does have a semicolon after it. I have also attached my connections and settings file. I have removed the database/username & password info but everything else is the same. Please let me know what I need to do get this working. I am very excited to use this package!
Thanks!
On 2/1/2018 12:02 AM, Taras Kopets wrote:
There might be several problems.
- the tables loading is done asynchronously, so it may take some time (up to a few seconds, depending if DB is remote or not) before they become available and listed in |ST: Describe Table|.
- sqlplus would not execute your query if the trailing semicolon |;| is missing
Did you have any errors in Sublime Text console (Ctrl+|or select|View → Show Console`)?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtxr/SQLTools/issues/188#issuecomment-362176733, or mute the thread https://github.com/notifications/unsubscribe-auth/AiWiu7HQkXwAY2I4IMVHdvW84I4uAEXCks5tQWFqgaJpZM4R09eT.
DPI scale: 1
startup, version: 3143 windows x64 channel: stable
executable: /C/Program Files/Sublime Text 3/sublime_text.exe
working dir: /C/Program Files/Sublime Text 3
packages path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Packages
state path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Local
zip path: /C/Program Files/Sublime Text 3/Packages
zip path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Installed Packages
ignored_packages: ["Vintage"]
Unable to decode Packages/One Dark Material - Theme/assets/darker/fold_down.png
pre session restore time: 0.649655
font face "Fira Code" could not be found, defaulting to "Consolas"
startup time: 0.696655
first paint time: 0.712655
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin A File Icon.A File Icon
reloading plugin Material Theme.Icons
reloading plugin Material Theme.MT
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 109, in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/init.py", line 90, in import_module
File "
{ "connections": { "Connection Oracle": { "type" : "oracle", "host" : "xxxxxxxx", "port" : 1521, "database": "xxxxxxxxx", "username": "xxxxxxxxxxxxxxxxxxx", "password": "xxxxxxx", "service" : "xxxxxxxxxxxxxxxxxxxxxxxxxxxx", // nls_lang is optional "nls_lang": "american_america.al32utf8", "encoding": "utf-8" },
},
"auto_complete_triggers": [ {"selector": "text.html", "characters": "<" }, {"selector": "source.sql", "characters": "."} ] , "default": null }
{ "cli": { "mysql" : "mysql", "pgsql" : "psql", "mssql" : "sqlcmd", "oracle" : "C:/Users/u0158391/Oracle/instantclient_12_2/instantclient_12_2/sqlplus.exe", "sqlite" : "sqlite3", "vertica" : "vsql", "firebird": "isql", "sqsh" : "sqsh" },
"cli_options": {
"oracle": {
"options": ["-S"],
"before": [
"SET LINESIZE 32767",
"SET WRAP OFF",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET TAB OFF",
"SET SERVEROUT ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET SQLBLANKLINES ON"
],
"after": [],
"env_optional": {
"NLS_LANG": "{nls_lang}"
},
"args": "{username}/{password}@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT={port})))(CONNECT_DATA=(SERVICE_NAME={service})))\"",
"queries": {
"execute": {
"options": [],
"before": [
// "SET TIMING ON",
"SET FEEDBACK ON"
]
},
"show records": {
"query": "select * from {0} where rownum <= {1};",
"options": [],
"before": [
"SET FEEDBACK ON"
]
},
"desc table": {
"query": "desc {0};",
"options": [],
"before": [
"SET LINESIZE 80", // override for readability
"SET WRAP ON", // override for readability
"SET FEEDBACK ON"
]
},
"desc function": {
"query": "select text from all_source where type in ('FUNCTION', 'PROCEDURE', 'PACKAGE', 'PACKAGE BODY') and name = nvl(substr(ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' ), 0, instr(ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' ), '.')-1), ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' )) and owner = sys_context('USERENV', 'CURRENT_SCHEMA') order by type, line;",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"explain plan": {
"query": "explain plan for {0};\nselect plan_table_output from table(dbms_xplan.display());",
"options": [],
"before": [
"SET FEEDBACK ON"
]
},
"desc" : {
"query": "select owner || '.' || case when upper(name) = name then name else chr(34) || name || chr(34) end as obj from (select owner, table_name as name from all_tables union all select owner, view_name as name from all_views) o where owner not in ('ANONYMOUS','APPQOSSYS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS', 'MDSYS','MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN', 'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST','WKSYS', 'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM','SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL','PUBLIC');",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"columns": {
"query": "select case when upper(table_name) = table_name then table_name else chr(34) || table_name || chr(34) end || '.' || case when upper(column_name) = column_name then column_name else chr(34) || column_name || chr(34) end as obj from (select c.table_name, c.column_name, t.owner from all_tab_columns c inner join all_tables t on c.owner = t.owner and c.table_name = t.table_name union all select c.table_name, c.column_name, t.owner from all_tab_columns c inner join all_views t on c.owner = t.owner and c.table_name = t.view_name) o where owner not in ('ANONYMOUS','APPQOSSYS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS', 'MDSYS','MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN', 'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST','WKSYS', 'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM','SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL','PUBLIC');",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"functions": {
"query": "select case when object_type = 'PACKAGE' then object_name||'.'||procedure_name else owner || '.' || object_name end || '()' as obj from all_procedures where object_type in ('FUNCTION','PROCEDURE','PACKAGE') and not (object_type = 'PACKAGE' and procedure_name is null) and owner = sys_context('USERENV', 'CURRENT_SCHEMA');",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
}
}
},
} }
FYI - in my original file I do have settings in the arguments. I just didnt want to broadcast that info to the world thats why I have removed them. Thanks! "args": "{username}/{password}@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT={port})))(CONNECT_DATA=(SERVICE_NAME={service})))\"",
You don't have to supply the actual values for username/passwords in cli_options
section of ST: Settings
(file Users/SQLTools.sublime-settings
).
With normal plugin usage, the cli_options
section should not be modified - it contains low-level plugin configuration and implementation details.
So don't fill in the actual values in this option, leave it as it is - even better, just remove this from your Users/SQLTools.sublime-settings
file.
To make it easier to debug and help you out please follow the steps below:
ST: Settings
, and in the right pane remove everything and put only this contents:
{
"cli": {
"mysql" : "mysql",
"pgsql" : "psql",
"mssql" : "sqlcmd",
"oracle" : "C:/Users/u0158391/Oracle/instantclient_12_2/instantclient_12_2/sqlplus.exe",
"sqlite" : "sqlite3",
"vertica" : "vsql",
"firebird": "isql",
"sqsh" : "sqsh"
}
}
ST: Setup Connections
, and in the right pane remove everything and put the contents below, replacing the xxxxxxxxxx
with you connection params:
{
"connections": {
"Connection Oracle": {
"type" : "oracle",
"host" : "xxxxxxxxxx",
"port" : 1521,
"database": "xxxxxxxxxx",
"username": "xxxxxxxxxx",
"password": "xxxxxxxxxx",
"service" : "xxxxxxxxxx",
// nls_lang is optional
"nls_lang": "american_america.al32utf8",
"encoding": "utf-8"
}
},
"default": null
}
Try to select your Oracle Connection via ST: Select Connection
and execute the selected piece of SQL e.g select 'one' from dual;
via ST: Execute
.
Let me know if that works for you.
ok did all the three steps. I think I am getting different errors now. I got the below error after I did 'Ctrl+Shift+P' > selected and enter "|ST: Select Connection":|
WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True Could not import subprocess32 module, falling back to subprocess module WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED False Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 797, in run return self.run() File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 482, in run ST.selectConnection() File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 359, in selectConnection ST.connectionList = getConnections() File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 96, in getConnections connectionsObj[name] = createConnection(name, config, settings=settings.all()) AttributeError: 'NoneType' object has no attribute 'all' |
---|
Then I ran |ST: Execute and I got this:
WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED True WINDOW COMMAND ENABLED False Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 797, in run return self.run() File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 559, in run ST.selectConnection(tablesCallback=lambda: Window().run_command('st_execute')) File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 359, in selectConnection ST.connectionList = getConnections() File "C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.py", line 96, in getConnections connectionsObj[name] = createConnection(name, config, settings=settings.all()) AttributeError: 'NoneType' object has no attribute 'all' | Thanks
On 2/1/2018 1:24 PM, Taras Kopets wrote:
You don't have to supply the actual values for username/passwords in |cli_options| section of |ST: Settings| (file |Users/SQLTools.sublime-settings|). With normal plugin usage, the |cli_options| section should not be modified - it contains low-level plugin configuration and implementation details. So don't fill in the actual values in this option, leave it as it is - even better, just remove this from your |Users/SQLTools.sublime-settings| file.
To make it easier to debug and help you out please follow the steps below:
- Run command |ST: Settings|, and in the right pane remove everything and put only this contents:
|{ "cli": { "mysql" : "mysql", "pgsql" : "psql", "mssql" : "sqlcmd", "oracle" : "C:/Users/u0158391/Oracle/instantclient_12_2/instantclient_12_2/sqlplus.exe", "sqlite" : "sqlite3", "vertica" : "vsql", "firebird": "isql", "sqsh" : "sqsh" } } |
- Run the command |ST: Setup Connections|, and in the right pane remove everything and put the contents below, replacing the |xxxxxxxxxx| with you connection params:
|{ "connections": { "Connection Oracle": { "type" : "oracle", "host" : "xxxxxxxxxx", "port" : 1521, "database": "xxxxxxxxxx", "username": "xxxxxxxxxx", "password": "xxxxxxxxxx", "service" : "xxxxxxxxxx", // nls_lang is optional "nls_lang": "american_america.al32utf8", "encoding": "utf-8" } }, "default": null } |
- Restart your Sublime Text editor - just to make sure that plugin will reload and re-read all of the settings.
Try to select your Oracle Connection via |ST: Select Connection| and execute the selected piece of SQL e.g |select 'one' from dual;| via |ST: Execute|.
Let me know if that works for you.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtxr/SQLTools/issues/188#issuecomment-362390731, or mute the thread https://github.com/notifications/unsubscribe-auth/AiWiuz6_9QBmaTzU7tYupQXnRhz88m6Lks5tQh1ogaJpZM4R09eT.
Looks like there is something wrong with SQLTools.sublime-settings
.
Can you copy-paste the entire contents of the Sublime console?
Most probably there is an error something like:
Failed to parse SQLTools.sublime-settings file
and also the reason why it failed to load.
Here you go. You are right, there is a line which says that. I have highlighted it in bold.
DPI scale: 1
startup, version: 3143 windows x64 channel: stable
executable: /C/Program Files/Sublime Text 3/sublime_text.exe
working dir: /C/Program Files/Sublime Text 3
packages path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Packages
state path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Local
zip path: /C/Program Files/Sublime Text 3/Packages
zip path: /C/Users/u0158391/AppData/Roaming/Sublime Text 3/Installed
Packages
ignored_packages: ["Vintage"]
Unable to decode Packages/One Dark Material -
Theme/assets/darker/fold_down.png
pre session restore time: 0.480457
font face "Fira Code" could not be found, defaulting to "Consolas"
startup time: 0.533457
first paint time: 0.549457
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin A File Icon.A File Icon
reloading plugin Material Theme.Icons
reloading plugin Material Theme.MT
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 109,
in reload_plugin
m = importlib.import_module(modulename)
File "./python3.3/importlib/init.py", line 90, in import_module
File "
On 2/1/2018 3:44 PM, Taras Kopets wrote:
Looks like there is something wrong with |SQLTools.sublime-settings|. Can you copy-paste the entire contents of the Sublime console? Most probably there is an error something like: |Failed to parse SQLTools.sublime-settings file| and also the reason why it failed to load.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mtxr/SQLTools/issues/188#issuecomment-362427217, or mute the thread https://github.com/notifications/unsubscribe-auth/AiWiu7jfsw26ePIpsmmoRjnuDtplK4c4ks5tQj5EgaJpZM4R09eT.
So you have some kind of problem - most probably malformed JSON at line 13 in SQLTools.sublime-settings
file.
This can be either in this file:
C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\ User\SQLTools.sublime-settings
or this one:
C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.sublime-settings
.
If you can't find the error yourself, copy-paste both of those files here or ask someone to help you.
I debugged the settings file and now it's working wonderfully. Thanks Taras and keep up the great work!
On Feb 1, 2018, 4:31 PM -0700, Taras Kopets notifications@github.com, wrote:
So you have some kind of problem - most probably malformed JSON at line 13 in SQLTools.sublime-settings file. This can be either in this file: C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\ User\SQLTools.sublime-settings or this one: C:\Users\u0158391\AppData\Roaming\Sublime Text 3\Packages\SQLTools\SQLTools.sublime-settings. If you can't find the error yourself, copy-paste both of those files here or ask someone to help you. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Issue Type
Feature Request | Bug/Error | Question | I am getting "Your database do not have any tables" error. Other
Description
I am getting "Your database do not have any tables" error. I am using sqlplus as my connection in sublime text. I created a sublime text build which uses the same path to sqlplus and it works fine that way. I updated the connections and also added the oracle arguments in my CLI settings file. It says that it executed the command but does not show the result. I then try to see if I have any tables (ctrl+e, ctrl+d) and the pop up shows "Your database has no tables". Any help is appreciated. Thank you!
Version
Steps to Reproduce (For bugfixes)
Expected behavior: [What you expected to happen]
Actual behavior: [What actually happened]