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.

Let’s start off with a single source, a Postgres Sakila database:

# Start the Postgres container
$ docker run -d -p 5432:5432 sakiladb/postgres:12

# Add the source
$ sq add postgres://sakila:p_ssW0rd@localhost/sakila --handle @sakila_pg
@sakila_pg  postgres  sakila@localhost/sakila

Inspect source

Use sq inspect @sakila_pg to inspect the source. This output includes the source metadata, and the schema structure (tables, columns, etc.).

--text (default)

$ sq inspect @sakila_pg

sq inspect source text


To see more detail, use the --verbose (-v) flag with the --text format.

sq inspect source verbose


To see the full output, use the --yaml (-y) flag. YAML has the advantage of being reasonably human-readable.

sq inspect source yaml


The --json (-j) format renders the same content as --yaml, but is more suited for use with other tools, such as jq.

sq_inspect_source json

Here’s an example of using sq with jq to list all table names:

$ sq inspect -j | jq -r '.tables[] | .name'


See more examples in the cookbook.

Source overview

Sometimes you don’t need the full schema, but still want to view the source metadata. Use the --overview (-O) mode to see just the top-level metadata. This excludes the schema structure, and is also much faster to complete.

sq inspect overview text

Well, that’s not a lot of detail. The --yaml output is more useful:


The --json format produces similar output.

Database properties

The --dbprops mode displays the underlying database’s properties, server config, and the like.

$ sq inspect @sakila_pg --dbprops


Use --dbprops with --yaml or --json to get the properties in machine-readable format. Note that while the returned structure is generally a set of key-value pairs, the specifics can vary significantly from one driver type to another. Here’s --dbprops from a SQLite database (in --yaml format):

sq inspect source dbprops sqlite yaml

Inspect table

In additional to inspecting a source, you can drill down on a specific table.

$ sq inspect

sq inspect table text

Use --verbose mode for more detail:

sq inspect table text verbose

And, as you might expect, you can also see the output in --json and --yaml formats.

sq inspect table json