Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docarray/array/mixins/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def summary(self):
all_attrs = self._get_attributes('non_empty_fields')
attr_counter = Counter(all_attrs)

table = Table(box=box.SIMPLE)
table = Table(box=box.SIMPLE, highlight=True)
table.show_header = False
table.add_row('Length', str(len(self)))
is_homo = len(attr_counter) == 1
Expand Down Expand Up @@ -77,7 +77,7 @@ def summary(self):
all_attrs_names = tuple(sorted(all_attrs_names))
if all_attrs_names:

attr_table = Table(box=box.SIMPLE)
attr_table = Table(box=box.SIMPLE, highlight=True)
attr_table.add_column('Attribute')
attr_table.add_column('Data type')
attr_table.add_column('#Unique values')
Expand All @@ -102,12 +102,18 @@ def summary(self):

storage_infos = self._get_storage_infos()
if storage_infos:
storage_table = Table(box=box.SIMPLE)
storage_table = Table(box=box.SIMPLE, highlight=True)
storage_table.show_header = False
for k, v in storage_infos.items():
storage_table.add_row(k, v)

tables.append(Panel(storage_table, title='Storage Summary', expand=False))
tables.append(
Panel(
storage_table,
title=f'[bold]{self.__class__.__name__}[/bold] Config',
expand=False,
)
)

console.print(*tables)

Expand Down
8 changes: 0 additions & 8 deletions docarray/array/storage/annlite/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,3 @@ def __setstate__(self, state):
from annlite import AnnLite

self._annlite = AnnLite(n_dim, lock=False, **config)

def _get_storage_infos(self) -> Dict:
return {
'Backend': 'AnnLite',
'Distance Metric': self._annlite.metric.name,
'Data Path': self._config.data_path,
'Serialization Protocol': self._config.serialize_config.get('protocol'),
}
4 changes: 3 additions & 1 deletion docarray/array/storage/base/backend.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from abc import ABC
from dataclasses import is_dataclass, asdict
from typing import Dict, Optional, TYPE_CHECKING

if TYPE_CHECKING:
Expand All @@ -16,7 +17,8 @@ def _init_storage(
self._load_offset2ids()

def _get_storage_infos(self) -> Optional[Dict]:
...
if hasattr(self, '_config') and is_dataclass(self._config):
return {k: str(v) for k, v in asdict(self._config).items()}

def _map_id(self, _id: str) -> str:
return _id
Expand Down
9 changes: 0 additions & 9 deletions docarray/array/storage/elastic/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,6 @@ def _refresh(self, index_name):
def _doc_id_exists(self, doc_id):
return self._client.exists(index=self._config.index_name, id=doc_id)

def _get_storage_infos(self) -> Dict:
return {
'Backend': 'ElasticSearch',
'Hosts': str(self._config.hosts),
'ES config': str(self._config.es_config),
'Distance': str(self._config.distance),
'Vector dimension': str(self._config.n_dim),
}

def _update_offset2ids_meta(self):
"""Update the offset2ids in elastic"""
if self._client.indices.exists(index=self._index_name_offset2id):
Expand Down
10 changes: 0 additions & 10 deletions docarray/array/storage/qdrant/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,6 @@ def _update_offset2ids_meta(self):
),
)

def _get_storage_infos(self) -> Dict:
return {
'Backend': 'Qdrant',
'Host': self._config.host,
'Port': str(self._config.port),
'Collection Name': self.collection_name,
'Distance': self._config.distance,
'Serialization Protocol': self._config.serialize_config.get('protocol'),
}

def _map_embedding(self, embedding: 'ArrayType') -> List[float]:
if embedding is None:
embedding = np.random.rand(self.n_dim)
Expand Down
8 changes: 0 additions & 8 deletions docarray/array/storage/sqlite/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,3 @@ def __setstate__(self, state):
check_same_thread=False,
**_conn_kwargs,
)

def _get_storage_infos(self) -> Dict:
return {
'Backend': 'SQLite',
'Connection': self._config.connection,
'Table Name': self._table_name,
'Serialization Protocol': self._config.serialize_config.get('protocol'),
}
10 changes: 0 additions & 10 deletions docarray/array/storage/weaviate/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,6 @@ def _map_embedding(self, embedding: 'ArrayType'):
embedding = None
return embedding

def _get_storage_infos(self) -> Dict:
return {
'Backend': 'Weaviate',
'Host': self._config.host,
'Port': str(self._config.port),
'Protocol': self._config.protocol,
'Schema Name': self._config.name,
'Serialization Protocol': self._config.serialize_config.get('protocol'),
}

def __getstate__(self):
d = dict(self.__dict__)
del d['_client']
Expand Down