blob: 9ace6bf9470db7d80e689c06a48b877dd80405da (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
 | from rethinkdb import ReqlOpFailedError
def run(db, table, table_obj):
    """
    Create a secondary index on the "snowflake" key, so we can easily get documents by matching that key
    """
    try:
        db.run(db.query(table).index_create("snowflake"))
        db.run(db.query(table).index_wait("snowflake"))
    except ReqlOpFailedError:
        print("Index already exists.")
 |