Mercurial > sqlpython
annotate docs/source/capabilities.rst @ 280:8ea39093ddf2
struggling with catching terminator after /*
author | catherine@dellzilla |
---|---|
date | Thu, 19 Mar 2009 13:14:39 -0400 |
parents | 3c5fa8ed4f8b |
children | 701f0aae837a |
rev | line source |
---|---|
247 | 1 SQLPython's extra capabilities |
2 ============================== | |
3 | |
4 For the most part, SQLPython simply duplicates SQL\*Plus's capabilites. | |
5 | |
279 | 6 Neatened output |
7 =============== | |
8 | |
9 When printing query results, sqlpython economizes on screen space by allocating | |
10 only the width each column actually needs. | |
11 | |
12 Smart prompt | |
13 ============ | |
14 | |
15 sqlpython automatically uses `username`@`instance`> as its prompt, helping | |
16 avoid wrong-instance and wrong-user errors. | |
17 | |
18 Tab completion | |
19 ============== | |
20 | |
21 When typing SQL commands, hitting `<TAB>` after entering part of an object | |
22 or column name brings up a list of appropriate possibilities or, if there | |
23 is only one possibility, fills in the rest of the name. This feature is | |
24 not yet very reliable, but can save typing. | |
25 | |
26 Scripting | |
27 ========= | |
28 | |
29 Like SQL\*Plus, sqlpython can run scripts (text files with series of SQL and | |
30 sqlpython commands) with `@/path/to/script.sql` or (for online scripts) | |
31 `@http://scripthost/scriptlibrary/script.sql`. | |
32 | |
33 History | |
34 ======= | |
35 | |
36 The up- and down-arrow keys allow you to scroll through the lines entered so far | |
37 in your sqlpython session. | |
38 | |
39 Commands are also entered into a command history. | |
40 | |
41 `history` or `hi` | |
42 List entire command history | |
43 | |
44 `list` or `li` | |
45 List only last command | |
46 | |
47 `hi <N>` | |
48 List command number <N> from history. | |
49 | |
50 `hi <N>-`, `hi -<N>` | |
51 List commands from <N> onward, or up to <N> | |
52 | |
53 `hi <str>` | |
54 Lists commands that include the string <str> | |
55 | |
56 `hi /<regex>/` | |
57 Lists commands that match the regular expression <regex> | |
58 | |
59 `run`, `r`, or `\\g` | |
60 Run the most recent command again | |
61 | |
62 `run <N>` | |
63 Run command <N> | |
64 | |
65 `run <str>`, `run /<regex>/` | |
66 Run command matching <str> or <regex> (as for `history`) - | |
67 if multiple items would match, run most recent | |
68 | |
247 | 69 UNIX-like commands |
70 ================== | |
71 | |
279 | 72 Many sqlpython commands allow you to act as though the database objects |
73 were files in a UNIX filesystem. Many of the commands also accept flags | |
74 to modify their behavior. | |
75 | |
247 | 76 ls |
279 | 77 Lists objects from the data dictionaries, as though they were in a |
280
8ea39093ddf2
struggling with catching terminator after /*
catherine@dellzilla
parents:
279
diff
changeset
|
78 *object_type*/*object_name* directory structure. Thus, `ls view/\*` |
279 | 79 lists all the user's views. |
247 | 80 |
81 cat | |
82 Shorthand for "SELECT * FROM" | |
83 | |
84 PostgreSQL-like shortcuts | |
85 ========================= | |
86 | |
87 ----- ------------------ | |
88 z y | |
89 ----- ------------------ | |
90 \\c connect | |
91 \\d desc | |
92 \\e edit | |
93 \\g run | |
94 \\h help | |
95 \\i load | |
96 \\o spool | |
97 \\p list | |
98 \\q quit | |
99 \\w save | |
100 \\db _dir_tablespaces | |
101 \\dd comments | |
102 \\dn _dir_schemas | |
103 \\dt _dir_tables | |
104 \\dv _dir_views | |
105 \\di _dir_indexes | |
106 \\? help psql | |
107 ----- ------------------ | |
108 | |
109 Wild SQL | |
110 ======== | |
111 | |
112 Wild SQL is a nonstandard SQL feature that must be enabled with `set wildsql on`. When it is | |
113 enabled, column names in a SELECT statement do not need to be explicitly typed. | |
114 | |
115 * % or \* as wildcards:: | |
116 | |
117 SELECT d* FROM v$database; | |
118 | |
119 SELECT | |
120 | |
121 Wild SQL can only be used in the primary column list of straightforward SELECT statements, | |
279 | 122 not in subqueries, `UNION`ed queries, etc. |