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