Regarding restricting user access to rows - Here’s a video tutorial explaining how to restrict acess to users in the context of a Todo List app. Sounds like your use-case is very similar:
Regarding accessing rows by ID: The list you see just holds internal information that Anvil uses to know where the data is in Postgres. You can just pass that in to get_by_id
without needing to know what the numbers mean.
I copied the jane_smith.get_id()
example from the Reference Docs, so taking a look there might help you:
https://anvil.works/doc/#-div-id-data_tables_api-using-data-tables-in-python-div-
# Get Jane Smith's row from the table
jane_smith = app_tables.people.get(Name="Jane Smith")
You can also get the same type of object using app_tables.people.search()
:
jane_smith = app_tables.people.search()[0]
The return value of search()
is a SearchIterator
, which is a lazily-evaluated view of the Data Table.
The return value of search()[0]
or get()
is a Row
, which is a lazily-evaluated view of an individual Data Table row.