GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing code.mteixeira.dev — SQLTools SQLTools
|
| Option | Description | Type | Default value |
|---|---|---|---|
cli |
Path to desired CLI binary executable. You can check more on Path to CLI | object |
|
expand_to |
Expand cursor selection according this setting upon running a query. Options: "file", "paragraph", "line". |
string |
file |
autocompletion |
Type of completion. "smart" - complete table columns and aliases, "basic" - basic DB objects, false - disable. |
string |
smart |
thread_timeout |
Query execution time in milliseconds before kill. Prevents from lockup while executing long running queries | int |
15 |
use_streams |
Stream results (line by line) to output | boolean |
false |
show_result_on_window |
Show query result using a window (true) or an output panel (false) |
boolean |
false |
clear_output |
Clear previous query results (true) vs. append new results to existing output (false) |
boolean |
true |
focus_on_result |
Move focus (cursor) to the output panel / result window after executing the query. | boolean |
false |
show_query |
Show the executed query alongside the results. Options: false (disabled), "top" or "bottom". |
mixed |
false |
safe_limit |
Set a default LIMIT on queries. Parameter can be an integer or false. |
int |
false |
unescape_quotes |
Escape chars like \” and \’ for extension in array | array |
[ "php" ] |
show_records |
Resultset settings. You can check more on Show records options | object |
{"limit": 50} |
format |
SQL formatting settings. You can check more on SQL Formatting | object |
| Option | Description | Type | Default value |
|---|---|---|---|
limit |
number of rows to show when using Show Table Records command | int |
50 |
| Option | Description | Type | Default value |
|---|---|---|---|
keyword_case |
Changes how keywords are formatted. Allowed values are "upper", "lower" and "capitalize" and null (leaves case intact) |
string |
"upper" |
identifier_case |
Changes how identifiers are formatted. Allowed values are "upper" "lower" and "capitalize"and null (leaves case intact) |
string |
null |
strip_comments |
Remove comments from file/selection | boolean |
false |
indent_tabs |
Use tabs instead of spaces | boolean |
false |
indent_width |
Indentation width | int |
4 |
reindent |
Reindent code if true |
boolean |
true |
In case your database command is not in your PATH environment var, you can set the path here.
| Option | Default value |
|---|---|
"mysql" |
"mysql" |
"pgsql" |
"psql" |
"mssql" |
"sqlcmd" |
"oracle" |
"sqlplus" |
"sqlite" |
"sqlite3" |
"vertica" |
"vsql" |
"firebird" |
"isql" |
"sqsh" |
"sqsh" |
"snowsql" |
"snowsql" |
You can setup your connections using the Preferences menu or CTRL+SHIFT+P and searching for ST: Setup Connections.
When you set any of the connection parameter value to null you will be prompted for this value upon connecting.
Below you can see an example of the SQLToolsConnections.sublime-settings:
{
"connections": {
"Connection MySQL": {
"type" : "mysql",
"host" : "127.0.0.1",
"port" : 3306,
"database": "dbname",
"username": "user",
"password": "password", // you will get a security warning in the output
// "defaults-extra-file": "/path/to/defaults_file_with_password", // use [client] or [mysql] section
// "login-path": "your_login_path", // login path in your ".mylogin.cnf"
"encoding": "utf-8"
},
"Connection PostgreSQL": {
"type" : "pgsql",
"host" : "127.0.0.1",
"port" : 5432,
"database": "dbname",
"username": "anotheruser",
// for PostgreSQL "password" is optional (setup "pgpass.conf" file instead)
"password": "password",
"encoding": "utf-8"
},
"Connection Oracle": {
"type" : "oracle",
"host" : "127.0.0.1",
"port" : 1522,
"database": "dbname",
"username": "anotheruser",
"password": "password",
"service" : "servicename",
"encoding": "utf-8"
},
"Connection SQLite": {
"type" : "sqlite",
"database": "d:/sqlite/sample_db/chinook.db",
"encoding": "utf-8"
}
},
"default": "Connection MySQL"
}
You can also add connections to your .sublime-project files to use per-project connections.
After you select one connection, SQLTools will prepare auto completions for you.
PS: For a better experience, add this line to your sublime settings file
CTRL+SHIFT+p, select “Preferences: Settings - User”{
"auto_complete_triggers": [
{"selector": "text.html", "characters": "<" },
{"selector": "source.sql", "characters": "."}
]
}
Sublime Text has it’s environment variable PATH set from launchctl, not by your shell. Binaries installed by packages such as homebrew, for instance psql DB CLI for PostgreSQL, cannot be found by Sublime Text and results in error in Sublime Text console by SQLTools. Installing the package Fix Mac Path or setting the full path to your DB CLI binary in SQLTools.sublime-settings resolves this issue. Package can be downloaded via PackageControl or github.