Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit ecfc768

Browse files
committed
Added SQSH support and environment vars inheritance
1 parent a42e145 commit ecfc768

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

SQLTools.sublime-settings

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"mysql" : "mysql",
1111
"pgsql" : "psql",
1212
"oracle" : "sqlplus",
13-
"vertica" : "vsql"
13+
"vertica" : "vsql",
14+
"sqsh" : "sqsh"
1415
},
1516
"show_records" : {
1617
"limit" : 50
@@ -148,7 +149,31 @@
148149
"format" : "|%s|"
149150
}
150151
}
152+
},
153+
"sqsh": {
154+
"options": [],
155+
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l\""],
156+
"args": "-S {options.host}:{options.port} -U\"{options.username}\" -P\"{options.password}\" -D{options.database}",
157+
"queries": {
158+
"desc": {
159+
"query": "select table_name from information_schema.tables order by 1;",
160+
"before" :["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
161+
"options": [],
162+
"format": "|%s|"
163+
},
164+
"desc table": {
165+
"query": "exec sp_columns \"%s\";",
166+
"options": [],
167+
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
168+
"format": "|%s|"
169+
},
170+
"show records": {
171+
"query": "select top 100 * from \"%s\";",
172+
"options": [],
173+
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
174+
"format": "|%s|"
175+
}
176+
}
151177
}
152178
}
153-
154179
}

SQLToolsModels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def run(self):
233233
self.tmp.close()
234234

235235
self.args = map(str, self.args)
236-
self.process = subprocess.Popen(self.args, stdout=subprocess.PIPE,stderr=subprocess.PIPE, stdin=open(self.tmp.name))
236+
self.process = subprocess.Popen(self.args, stdout=subprocess.PIPE,stderr=subprocess.PIPE, stdin=open(self.tmp.name), env=os.environ.copy())
237237

238238
results, errors = self.process.communicate()
239239

0 commit comments

Comments
 (0)