diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 1fa166fa..c41f2933 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -62,6 +62,7 @@ plugins: # for cross references - https://arrow.apache.org/docs/objects.inv - https://pandas.pydata.org/docs/objects.inv + - https://lancedb.github.io/lance/objects.inv - mkdocs-jupyter - render_swagger: allow_arbitrary_locations: true diff --git a/docs/src/python/saas-python.md b/docs/src/python/saas-python.md index e2ea3047..9e549411 100644 --- a/docs/src/python/saas-python.md +++ b/docs/src/python/saas-python.md @@ -17,4 +17,8 @@ pip install lancedb ## Table ::: lancedb.remote.table.RemoteTable - + options: + filters: + - "!cleanup_old_versions" + - "!compact_files" + - "!optimize" diff --git a/python/python/lancedb/remote/table.py b/python/python/lancedb/remote/table.py index 5801ba52..73236e9b 100644 --- a/python/python/lancedb/remote/table.py +++ b/python/python/lancedb/remote/table.py @@ -15,6 +15,7 @@ from datetime import timedelta import logging from functools import cached_property from typing import Dict, Iterable, List, Optional, Union, Literal +import warnings from lancedb._lancedb import IndexConfig from lancedb.embeddings.base import EmbeddingFunctionConfig @@ -481,16 +482,28 @@ class RemoteTable(Table): ) def cleanup_old_versions(self, *_): - """cleanup_old_versions() is not supported on the LanceDB cloud""" - raise NotImplementedError( - "cleanup_old_versions() is not supported on the LanceDB cloud" + """ + cleanup_old_versions() is a no-op on LanceDB Cloud. + + Tables are automatically cleaned up and optimized. + """ + warnings.warn( + "cleanup_old_versions() is a no-op on LanceDB Cloud. " + "Tables are automatically cleaned up and optimized." ) + pass def compact_files(self, *_): - """compact_files() is not supported on the LanceDB cloud""" - raise NotImplementedError( - "compact_files() is not supported on the LanceDB cloud" + """ + compact_files() is a no-op on LanceDB Cloud. + + Tables are automatically compacted and optimized. + """ + warnings.warn( + "compact_files() is a no-op on LanceDB Cloud. " + "Tables are automatically compacted and optimized." ) + pass def optimize( self, @@ -498,12 +511,16 @@ class RemoteTable(Table): cleanup_older_than: Optional[timedelta] = None, delete_unverified: bool = False, ): - """optimize() is not supported on the LanceDB cloud. - Indices are optimized automatically.""" - raise NotImplementedError( - "optimize() is not supported on the LanceDB cloud. " + """ + optimize() is a no-op on LanceDB Cloud. + + Indices are optimized automatically. + """ + warnings.warn( + "optimize() is a no-op on LanceDB Cloud. " "Indices are optimized automatically." ) + pass def count_rows(self, filter: Optional[str] = None) -> int: return LOOP.run(self._table.count_rows(filter)) diff --git a/python/python/lancedb/table.py b/python/python/lancedb/table.py index 4ba73405..34175844 100644 --- a/python/python/lancedb/table.py +++ b/python/python/lancedb/table.py @@ -917,9 +917,6 @@ class Table(ABC): """ Clean up old versions of the table, freeing disk space. - Note: This function is not available in LanceDb Cloud (since LanceDb - Cloud manages cleanup for you automatically) - Parameters ---------- older_than: timedelta, default None @@ -936,21 +933,38 @@ class Table(ABC): CleanupStats The stats of the cleanup operation, including how many bytes were freed. + + See Also + -------- + [Table.optimize][lancedb.table.Table.optimize]: A more comprehensive + optimization operation that includes cleanup as well as other operations. + + Notes + ----- + This function is not available in LanceDb Cloud (since LanceDB + Cloud manages cleanup for you automatically) """ @abstractmethod def compact_files(self, *args, **kwargs): """ Run the compaction process on the table. - - Note: This function is not available in LanceDb Cloud (since LanceDb - Cloud manages compaction for you automatically) - This can be run after making several small appends to optimize the table for faster reads. - Arguments are passed onto :meth:`lance.dataset.DatasetOptimizer.compact_files`. + Arguments are passed onto Lance's + [compact_files][lance.dataset.DatasetOptimizer.compact_files]. For most cases, the default should be fine. + + See Also + -------- + [Table.optimize][lancedb.table.Table.optimize]: A more comprehensive + optimization operation that includes cleanup as well as other operations. + + Notes + ----- + This function is not available in LanceDB Cloud (since LanceDB + Cloud manages compaction for you automatically) """ @abstractmethod