Skip to content

Commit

Permalink
cqlengine/management.py: handle more options of views names
Browse files Browse the repository at this point in the history
so far the code assumed view can be name like:
```python
possible_names = [name, f'values({name})']
```

we have now one more option, that need to be considered:
```python
f'keys({name})'
```
  • Loading branch information
fruch committed Jul 2, 2024
1 parent b35f24c commit aeb8fe6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cassandra/cqlengine/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def _get_index_name_by_column(table, column_name):
Find the index name for a given table and column.
"""
protected_name = metadata.protect_name(column_name)
possible_index_values = [protected_name, "values(%s)" % protected_name]
possible_index_values = [protected_name, "values(%s)" % protected_name, "keys(%s)" % protected_name]
for index_metadata in table.indexes.values():
options = dict(index_metadata.index_options)

if options.get('target') in possible_index_values:
return index_metadata.name

Expand Down

0 comments on commit aeb8fe6

Please sign in to comment.