sq inspect
sq inspect
inspects metadata (schema/structure, tables, columns) for a source,
or for an individual table. When used with --json
, the output of sq inspect
can
be fed into other tools such as jq to enable complex data pipelines.
See the inspect guide for an overview of sq inspect
.
Reference
Inspect a data source, or a particular table in a source,
listing table details such as column names and row counts, etc.
NOTE: If a schema is large, it may take some time for the command to complete.
If @HANDLE is not provided, the active data source is assumed.
When flag --overview is true, only the source's' metadata is shown,
not the schema. The flag is disregarded when inspecting a table.
When flag --dbprops is true, only the database properties for the source's
*underlying* database are shown. The flag is disregarded when inspecting a table.
Use --verbose with the --text format to see more detail. The --json and --yaml
formats both show extensive detail.
Usage:
sq inspect [@HANDLE|@HANDLE.TABLE|.TABLE]
Examples:
# Inspect active data source.
$ sq inspect
# Inspect @pg1 data source.
$ sq inspect @pg1
# Inspect @pg1 data source, showing verbose output.
$ sq inspect -v @pg1
# Show output in JSON (useful for piping to jq).
$ sq inspect --json @pg1
# Show output in YAML.
$ sq inspect --yaml @pg1
# Show only the DB properties for @pg1.
$ sq inspect --dbprops @pg1
# Show only the source metadata (and not schema details).
$ sq inspect --overview @pg1
# Inspect table "actor" in @pg1 data source.
$ sq inspect @pg1.actor
# Inspect "actor" in active data source.
$ sq inspect .actor
# Inspect piped data.
$ cat data.xlsx | sq inspect
Flags:
-t, --text Output text
-h, --header Print header row (default true)
-H, --no-header Don't print header row
-j, --json Output JSON
-c, --compact Compact instead of pretty-printed output
-y, --yaml Output YAML
-O, --overview Show metadata only (no schema)
-p, --dbprops Show DB properties only
--help help for inspect
Global Flags:
--config string Load config from here
--log Enable logging
--log.file string Path to log file; empty disables logging
--log.level string Log level: one of DEBUG, INFO, WARN, ERROR
-M, --monochrome Don't colorize output
-v, --verbose Verbose output