How to get a list of all of a database's secondary indixes in RethinkDB
<p>In Python, how can I get a list of all a database's secondary indixes?</p>

<p>For example, in the web UI under "Tables" you can see the list of "Secondary indexes" (in this case only <code>timestamp</code>); I would like to get this in the Python environment.</p>

<p><a href="https://i.stack.imgur.com/jky7D.png" rel="nofollow"><img src="https://i.stack.imgur.com/jky7D.png" alt="enter image description here"></a></p>

<p>Check <a href="https://www.rethinkdb.com/docs/secondary-indexes/python/" rel="nofollow">this</a> doc about secondary indexes in RethinkDB.</p>

<p>You can get list of all indexes on table (e.x. "users") using this query:</p>

<pre><code>r.table("users").index_list()
</code></pre>

<p>If you want to get all secondary indexes for all tables, you can query table list and after that get indexes for each. I don't know python, but in Java Script you can do it using this query:</p>

<pre><code>r.tableList().map(function(table){
  return {table: table,
    indexes: r.table(table).indexList()};
})
</code></pre>

<p>I think, in python it looks like this:</p>

<pre><code>r.table_list().map(lambda name:{table: name,indexes: r.table(name).index_list()})
</code></pre>

python rethinkdb