Skip to content

Commit 0175e76

Browse files
committed
signature change in create[vector]index table methods
1 parent cb49d8d commit 0175e76

File tree

6 files changed

+30
-29
lines changed

6 files changed

+30
-29
lines changed

CHANGES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Spawner methods for databases/admins standardized; they don't issue DevOps API c
1818
- `region` now required if `id` passed instead of endpoint.
1919
Support for Astra DB "custom domain" endpoints for database
2020
- in which case: `.id`, `.region`, `.get_database_admin()`, `.info()` and `.name()` aren't available.
21-
Support for the `indexType` field to describe table indexes (for compatibility, said field is not mandatory).
21+
Table indexes:
22+
- Support for the `indexType` field to describe table indexes (for compatibility, said field is not mandatory).
23+
- 'column' argument for create[Vector]Index table metods is now positional (after index name)
2224
Collections write path now obeys the binary-encoding API Option (which in turn defaults to True. Formerly bin-encoding was always turned off.)
2325
DataAPITime: support for "hh:mm" no-seconds format.
2426
DataAPIDuration: improved parse performance by caching regexpes.

astrapy/data/info/table_descriptor/table_indexes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class TableIndexType(StrEnum):
3131
Enum to describe the index types for Table columns.
3232
"""
3333

34-
COLLECTION = "collection"
3534
REGULAR = "regular"
3635
TEXT_ANALYSED = "text-analysed"
3736
UNKNOWN = "UNKNOWN"

astrapy/data/table.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ def _create_generic_index(
597597
def create_index(
598598
self,
599599
name: str,
600-
*,
601600
column: str,
601+
*,
602602
options: TableIndexOptions | dict[str, Any] | None = None,
603603
if_not_exists: bool | None = None,
604604
table_admin_timeout_ms: int | None = None,
@@ -637,13 +637,13 @@ def create_index(
637637
>>> # create an index on a column
638638
>>> my_table.create_index(
639639
... "score_index",
640-
... column="score",
640+
... "score",
641641
... )
642642
>>>
643643
>>> # create an index on a textual column, specifying indexing options
644644
>>> my_table.create_index(
645645
... "winner_index",
646-
... column="winner",
646+
... "winner",
647647
... options=TableIndexOptions(
648648
... ascii=False,
649649
... normalize=True,
@@ -670,8 +670,8 @@ def create_index(
670670
def create_vector_index(
671671
self,
672672
name: str,
673-
*,
674673
column: str,
674+
*,
675675
options: TableVectorIndexOptions | dict[str, Any] | None = None,
676676
if_not_exists: bool | None = None,
677677
table_admin_timeout_ms: int | None = None,
@@ -713,7 +713,7 @@ def create_vector_index(
713713
>>> # create a vector index with dot-product similarity
714714
>>> my_table.create_vector_index(
715715
... "m_vector_index",
716-
... column="m_vector",
716+
... "m_vector",
717717
... options=TableVectorIndexOptions(
718718
... metric=VectorMetric.DOT_PRODUCT,
719719
... ),
@@ -722,7 +722,7 @@ def create_vector_index(
722722
>>> # succeeded, this will do nothing because of `if_not_exists`):
723723
>>> my_table.create_vector_index(
724724
... "m_vector_index",
725-
... column="m_vector",
725+
... "m_vector",
726726
... options=TableVectorIndexOptions(
727727
... metric=VectorMetric.DOT_PRODUCT,
728728
... source_model="nv-qa-4",
@@ -734,7 +734,7 @@ def create_vector_index(
734734
>>> # succeeded, this will do nothing because of `if_not_exists`):
735735
>>> my_table.create_vector_index(
736736
... "m_vector_index",
737-
... column="m_vector",
737+
... "m_vector",
738738
... if_not_exists=True,
739739
... )
740740
"""
@@ -3311,8 +3311,8 @@ async def _create_generic_index(
33113311
async def create_index(
33123312
self,
33133313
name: str,
3314-
*,
33153314
column: str,
3315+
*,
33163316
options: TableIndexOptions | dict[str, Any] | None = None,
33173317
if_not_exists: bool | None = None,
33183318
table_admin_timeout_ms: int | None = None,
@@ -3353,13 +3353,13 @@ async def create_index(
33533353
>>> # create an index on a column
33543354
>>> await my_async_table.create_index(
33553355
... "score_index",
3356-
... column="score",
3356+
... "score",
33573357
... )
33583358
>>>
33593359
>>> # create an index on a textual column, specifying indexing options
33603360
>>> await my_async_table.create_index(
33613361
... "winner_index",
3362-
... column="winner",
3362+
... "winner",
33633363
... options=TableIndexOptions(
33643364
... ascii=False,
33653365
... normalize=True,
@@ -3386,8 +3386,8 @@ async def create_index(
33863386
async def create_vector_index(
33873387
self,
33883388
name: str,
3389-
*,
33903389
column: str,
3390+
*,
33913391
options: TableVectorIndexOptions | dict[str, Any] | None = None,
33923392
if_not_exists: bool | None = None,
33933393
table_admin_timeout_ms: int | None = None,
@@ -3431,7 +3431,7 @@ async def create_vector_index(
34313431
>>> # create a vector index with dot-product similarity
34323432
>>> await my_async_table.create_vector_index(
34333433
... "m_vector_index",
3434-
... column="m_vector",
3434+
... "m_vector",
34353435
... options=TableVectorIndexOptions(
34363436
... metric=VectorMetric.DOT_PRODUCT,
34373437
... ),
@@ -3440,7 +3440,7 @@ async def create_vector_index(
34403440
>>> # succeeded, this will do nothing because of `if_not_exists`):
34413441
>>> await my_async_table.create_vector_index(
34423442
... "m_vector_index",
3443-
... column="m_vector",
3443+
... "m_vector",
34443444
... options=TableVectorIndexOptions(
34453445
... metric=VectorMetric.DOT_PRODUCT,
34463446
... source_model="nv-qa-4",
@@ -3452,7 +3452,7 @@ async def create_vector_index(
34523452
>>> # succeeded, this will do nothing because of `if_not_exists`):
34533453
>>> await my_async_table.create_vector_index(
34543454
... "m_vector_index",
3455-
... column="m_vector",
3455+
... "m_vector",
34563456
... if_not_exists=True,
34573457
... )
34583458
"""

tests/base/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def sync_table_simple(
288288
)
289289
table.create_vector_index(
290290
TEST_SIMPLE_TABLE_VECTOR_INDEX_NAME,
291-
column=TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
291+
TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
292292
options=TEST_SIMPLE_TABLE_VECTOR_INDEX_OPTIONS,
293293
)
294294
yield table
@@ -333,12 +333,12 @@ def sync_table_composite(
333333
)
334334
table.create_vector_index(
335335
TEST_COMPOSITE_TABLE_VECTOR_INDEX_NAME,
336-
column=TEST_COMPOSITE_TABLE_VECTOR_INDEX_COLUMN,
336+
TEST_COMPOSITE_TABLE_VECTOR_INDEX_COLUMN,
337337
options=TEST_COMPOSITE_TABLE_VECTOR_INDEX_OPTIONS,
338338
)
339339
table.create_index(
340340
TEST_COMPOSITE_TABLE_BOOLEAN_INDEX_NAME,
341-
column=TEST_COMPOSITE_TABLE_BOOLEAN_INDEX_COLUMN,
341+
TEST_COMPOSITE_TABLE_BOOLEAN_INDEX_COLUMN,
342342
options=TEST_COMPOSITE_TABLE_BOOLEAN_INDEX_OPTIONS,
343343
)
344344
yield table
@@ -383,7 +383,7 @@ def sync_table_vectorize(
383383
)
384384
table.create_vector_index(
385385
TEST_VECTORIZE_TABLE_VECTOR_INDEX_NAME,
386-
column=TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
386+
TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
387387
options=TEST_SIMPLE_TABLE_VECTOR_INDEX_OPTIONS,
388388
)
389389
yield table
@@ -428,7 +428,7 @@ def sync_table_kms_vectorize(
428428
)
429429
table.create_vector_index(
430430
TEST_KMS_VECTORIZE_TABLE_VECTOR_INDEX_NAME,
431-
column=TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
431+
TEST_SIMPLE_TABLE_VECTOR_INDEX_COLUMN,
432432
options=TEST_SIMPLE_TABLE_VECTOR_INDEX_OPTIONS,
433433
)
434434
yield table

tests/base/integration/tables/test_table_lifecycle_async.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ async def test_tableindex_basic_crd_async(
266266

267267
await table.create_index(
268268
"tfi_idx_p_text",
269-
column="p_text",
269+
"p_text",
270270
options=TableIndexOptions(
271271
ascii=False,
272272
normalize=True,
@@ -275,18 +275,18 @@ async def test_tableindex_basic_crd_async(
275275
)
276276
await table.create_index(
277277
"tfi_idx_p_int",
278-
column="p_int",
278+
"p_int",
279279
)
280280
await table.create_vector_index(
281281
"tfi_idx_p_vector_sm",
282-
column="p_vector_sm",
282+
"p_vector_sm",
283283
options=TableVectorIndexOptions(
284284
metric="cosine",
285285
),
286286
)
287287
await table.create_vector_index(
288288
"tfi_idx_p_vector",
289-
column="p_vector",
289+
"p_vector",
290290
options=TableVectorIndexOptions(
291291
source_model="openai-v3-large",
292292
),

tests/base/integration/tables/test_table_lifecycle_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def test_tableindex_basic_crd_sync(
265265

266266
table.create_index(
267267
"tfi_idx_p_text",
268-
column="p_text",
268+
"p_text",
269269
options=TableIndexOptions(
270270
ascii=False,
271271
normalize=True,
@@ -274,18 +274,18 @@ def test_tableindex_basic_crd_sync(
274274
)
275275
table.create_index(
276276
"tfi_idx_p_int",
277-
column="p_int",
277+
"p_int",
278278
)
279279
table.create_vector_index(
280280
"tfi_idx_p_vector_sm",
281-
column="p_vector_sm",
281+
"p_vector_sm",
282282
options=TableVectorIndexOptions(
283283
metric="cosine",
284284
),
285285
)
286286
table.create_vector_index(
287287
"tfi_idx_p_vector",
288-
column="p_vector",
288+
"p_vector",
289289
options=TableVectorIndexOptions(
290290
source_model="openai-v3-large",
291291
),

0 commit comments

Comments
 (0)