Commit 8e87ae9
committed
let reconnect preserve session state
Followups to reconnect() refactor:
* Before attempting sqlexecute.connect(), try ping(reconnect=True)
to do a true reconnect, preserving the connection_id() and other
state such as session variables. This is the important part, which
the commentary calls the "second pass".
* Also, before attempting ping(reconnect=True), try
ping(reconnect=False) with fewer feedback messages, which the
commentary calls the "first pass". This pass is helpful to keep
chatter down when the user habitually chooses the "connect" verb over
"use".
* Add new explicit feedback around creating a new connection when doing
so, including a red tip to the user that session state was lost.
* Tweak docstring in manual_reconnect() eg: "real function" -> "utility
method"
* Move db-change logic out of utility method, into manual_reconnect()
and change_db(), keeping the "database" optional argument, as it is
still useful for finessing feedback messages.
* Silently skip changing the database if it equals "``".
* In the usual case, let manual_reconnect() yield the result of
change_db(), leaving us directly hooked in to the 4-tuple return-
value system (instead of iterating on change_db() internally and
manually handling the echo()).
* Add an assert on self.sqlexecute.conn before pinging it.
* Clarify "database" vs "server" in reconnect() docstring.
(Pedantically it could be "cluster" or "endpoint").
* Update changelog, but just piggyback two words onto the previous
entry.
* Update tests to use mycli.packages.special.execute() rather than
CliRunner(). CliRunner() is only capable of testing the first
line of output, which is taken up by an initialization statement.1 parent be626f8 commit 8e87ae9
File tree
4 files changed
+122
-33
lines changed- mycli
- test
- features/steps
4 files changed
+122
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
| 265 | + | |
| 266 | + | |
267 | 267 | | |
268 | | - | |
269 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
270 | 274 | | |
271 | 275 | | |
272 | 276 | | |
| |||
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
311 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
312 | 321 | | |
313 | 322 | | |
314 | 323 | | |
315 | 324 | | |
316 | 325 | | |
317 | | - | |
| 326 | + | |
318 | 327 | | |
319 | 328 | | |
320 | 329 | | |
| |||
1036 | 1045 | | |
1037 | 1046 | | |
1038 | 1047 | | |
1039 | | - | |
| 1048 | + | |
1040 | 1049 | | |
| 1050 | + | |
| 1051 | + | |
1041 | 1052 | | |
1042 | 1053 | | |
1043 | | - | |
1044 | | - | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1045 | 1078 | | |
| 1079 | + | |
| 1080 | + | |
1046 | 1081 | | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
1047 | 1086 | | |
1048 | 1087 | | |
1049 | 1088 | | |
1050 | 1089 | | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | 1090 | | |
1060 | 1091 | | |
1061 | 1092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
43 | 62 | | |
44 | | - | |
45 | | - | |
46 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
47 | 67 | | |
48 | 68 | | |
49 | 69 | | |
50 | 70 | | |
51 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
52 | 90 | | |
53 | 91 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
57 | 95 | | |
58 | 96 | | |
59 | 97 | | |
60 | 98 | | |
61 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
62 | 118 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
67 | 125 | | |
68 | 126 | | |
69 | 127 | | |
| |||
0 commit comments