Cross-link CLI to Python docs (#460)

* Start cross-linking CLI to Python docs, refs #426
* More links to Python from CLI page, refs #426
This commit is contained in:
Simon Willison 2022-08-18 14:58:07 -07:00 committed by GitHub
commit f4fb78fa95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 110 additions and 0 deletions

View file

@ -21,6 +21,9 @@ The ``sqlite-utils query`` command lets you run queries directly against a SQLit
$ sqlite-utils query dogs.db "select * from dogs"
$ sqlite-utils dogs.db "select * from dogs"
.. note::
In Python: :ref:`db.query() <python_api_query>` CLI reference: :ref:`sqlite-utils query <cli_ref_query>`
.. _cli_query_json:
Returning JSON
@ -257,6 +260,7 @@ You can load SQLite extension modules using the ``--load-extension`` option, see
$ sqlite-utils dogs.db "select spatialite_version()" --load-extension=spatialite
[{"spatialite_version()": "4.3.0a"}]
.. _cli_query_attach:
Attaching additional databases
@ -271,6 +275,9 @@ This example attaches the ``books.db`` database under the alias ``books`` and th
sqlite-utils dogs.db --attach books books.db \
'select * from sqlite_master union all select * from books.sqlite_master'
.. note::
In Python: :ref:`db.attach() <python_api_attach>`
.. _cli_memory:
Querying data directly using an in-memory database
@ -462,6 +469,9 @@ Or pass named parameters using ``--where`` in combination with ``-p``::
Use ``--limit N`` to only return the first ``N`` rows. Use ``--offset N`` to return rows starting from the specified offset.
.. note::
In Python: :ref:`table.rows <python_api_rows>` CLI reference: :ref:`sqlite-utils rows <cli_ref_rows>`
.. _cli_tables:
Listing tables
@ -514,6 +524,9 @@ Use ``--schema`` to include the schema of each table::
The ``--nl``, ``--csv``, ``--tsv``, ``--table`` and ``--fmt`` options are also available.
.. note::
In Python: :ref:`db.tables or db.table_names() <python_api_tables>` CLI reference: :ref:`sqlite-utils tables <cli_ref_tables>`
.. _cli_views:
Listing views
@ -537,6 +550,9 @@ It takes the same options as the ``tables`` command:
* ``--tsv``
* ``--table``
.. note::
In Python: :ref:`db.views or db.view_names() <python_api_views>` CLI reference: :ref:`sqlite-utils views <cli_ref_views>`
.. _cli_indexes:
Listing indexes
@ -564,6 +580,9 @@ The command defaults to only showing the columns that are explicitly part of the
The command takes the same format options as the ``tables`` and ``views`` commands.
.. note::
In Python: :ref:`table.indexes <python_api_introspection_indexes>` CLI reference: :ref:`sqlite-utils indexes <cli_ref_indexes>`
.. _cli_triggers:
Listing triggers
@ -592,6 +611,9 @@ It defaults to showing triggers for all tables. To see triggers for one or more
The command takes the same format options as the ``tables`` and ``views`` commands.
.. note::
In Python: :ref:`table.triggers or db.triggers <python_api_introspection_triggers>` CLI reference: :ref:`sqlite-utils triggers <cli_ref_triggers>`
.. _cli_schema:
Showing the schema
@ -610,6 +632,9 @@ This will show the schema for every table and index in the database. To view the
$ sqlite-utils schema dogs.db dogs chickens
...
.. note::
In Python: :ref:`table.schema <python_api_introspection_schema>` or :ref:`db.schema <python_api_schema>` CLI reference: :ref:`sqlite-utils schema <cli_ref_schema>`
.. _cli_analyze_tables:
Analyzing tables