mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 01:44:31 +02:00
Update docs: db[] only returns tables, not views
Updated python-api.rst to clarify that dictionary-style syntax
db["name"] only returns Table objects. Use db.view("name") for views.
This commit is contained in:
parent
c791a31047
commit
147fd7e48b
1 changed files with 4 additions and 2 deletions
|
|
@ -282,11 +282,13 @@ Using this factory function allows you to set :ref:`python_api_table_configurati
|
|||
|
||||
The ``db.table()`` method will always return a :ref:`reference_db_table` instance, or raise a ``sqlite_utils.db.NoTable`` exception if the table name is actually a SQL view.
|
||||
|
||||
You can also access tables or views using dictionary-style syntax, like this:
|
||||
You can also access tables using dictionary-style syntax, like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
table_or_view = db["my_table_or_view_name"]
|
||||
table = db["my_table_name"]
|
||||
|
||||
This is equivalent to calling ``db.table("my_table_name")``. It will raise a ``sqlite_utils.db.NoTable`` exception if the name refers to a view rather than a table.
|
||||
|
||||
If a table accessed using either of these methods does not yet exist, it will be created the first time you attempt to insert or upsert data into it.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue