pixeltable 0.2.24__tar.gz → 0.2.25__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pixeltable might be problematic. Click here for more details.
- {pixeltable-0.2.24 → pixeltable-0.2.25}/PKG-INFO +3 -3
- {pixeltable-0.2.24 → pixeltable-0.2.25}/README.md +2 -2
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/__version__.py +2 -2
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/table.py +131 -41
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/view.py +3 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/similarity_expr.py +3 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/function.py +37 -1
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/signature.py +1 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/mistralai.py +0 -2
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/globals.py +28 -17
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/index/embedding_index.py +6 -1
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/iterators/__init__.py +1 -0
- pixeltable-0.2.25/pixeltable/iterators/image.py +100 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/iterators/video.py +7 -8
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/plan.py +1 -1
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/create_test_db_dump.py +4 -1
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pyproject.toml +2 -2
- {pixeltable-0.2.24 → pixeltable-0.2.25}/LICENSE +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/catalog.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/column.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/dir.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/globals.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/insertable_table.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/named_function.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/path.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/path_dict.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/schema_object.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/table_version.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/catalog/table_version_path.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/dataframe.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/env.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exceptions.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/aggregation_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/cache_prefetch_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/component_iteration_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/data_row_batch.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/exec_context.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/exec_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/expr_eval_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/in_memory_data_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/row_update_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exec/sql_node.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/arithmetic_expr.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/array_slice.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/column_property_ref.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/column_ref.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/comparison.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/compound_predicate.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/data_row.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/expr.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/expr_dict.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/expr_set.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/function_call.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/globals.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/in_predicate.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/inline_expr.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/is_null.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/json_mapper.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/json_path.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/literal.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/method_ref.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/object_ref.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/row_builder.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/rowid_ref.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/sql_element_cache.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/type_cast.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/exprs/variable.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/ext/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/ext/functions/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/ext/functions/whisperx.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/ext/functions/yolox.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/aggregate_function.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/callable_function.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/expr_template_function.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/function_registry.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/globals.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/query_template_function.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/func/udf.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/anthropic.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/audio.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/fireworks.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/globals.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/huggingface.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/image.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/json.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/llama_cpp.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/ollama.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/openai.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/replicate.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/string.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/timestamp.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/together.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/util.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/video.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/vision.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/functions/whisper.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/index/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/index/base.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/index/btree.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/external_store.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/fiftyone.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/globals.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/hf_datasets.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/label_studio.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/pandas.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/io/parquet.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/iterators/base.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/iterators/document.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/iterators/string.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_10.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_12.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_13.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_14.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_15.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_16.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_17.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_18.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_19.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_20.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/convert_21.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/converters/util.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/notes.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/metadata/schema.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/py.typed +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/store.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/create_test_video.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/doc_plugins/griffe.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/doc_plugins/mkdocstrings.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/doc_plugins/templates/material/udf.html.jinja +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/embed_udf.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/tool/mypy_plugin.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/type_system.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/__init__.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/arrow.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/coco.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/code.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/documents.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/filecache.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/formatter.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/http_server.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/media_store.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/pytorch.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/s3.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/sql.py +0 -0
- {pixeltable-0.2.24 → pixeltable-0.2.25}/pixeltable/utils/transactional_directory.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pixeltable
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.25
|
|
4
4
|
Summary: Pixeltable: The Multimodal AI Data Plane
|
|
5
5
|
Author: Pixeltable, Inc.
|
|
6
6
|
Author-email: contact@pixeltable.com
|
|
@@ -40,7 +40,7 @@ Description-Content-Type: text/markdown
|
|
|
40
40
|
alt="Pixeltable" width="50%" />
|
|
41
41
|
<br></br>
|
|
42
42
|
|
|
43
|
-
<h2>AI Data
|
|
43
|
+
<h2>AI Data Infrastructure — Declarative, Multimodal, and Incremental</h2>
|
|
44
44
|
|
|
45
45
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
46
46
|

|
|
@@ -48,8 +48,8 @@ Description-Content-Type: text/markdown
|
|
|
48
48
|
<br>
|
|
49
49
|
[](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml)
|
|
50
50
|
[](https://github.com/pixeltable/pixeltable/actions/workflows/nightly.yml)
|
|
51
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fpixeltable%2Fpixeltable?ref=badge_shield&issueType=security)
|
|
52
51
|
[](https://pypi.org/project/pixeltable/)
|
|
52
|
+
[](https://discord.gg/QPyqFYx2UN)
|
|
53
53
|
<a target="_blank" href="https://huggingface.co/Pixeltable">
|
|
54
54
|
<img src="https://img.shields.io/badge/🤗-HF Space-FF7D04" alt="Visit our Hugging Face space"/>
|
|
55
55
|
</a>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
alt="Pixeltable" width="50%" />
|
|
4
4
|
<br></br>
|
|
5
5
|
|
|
6
|
-
<h2>AI Data
|
|
6
|
+
<h2>AI Data Infrastructure — Declarative, Multimodal, and Incremental</h2>
|
|
7
7
|
|
|
8
8
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
9
9
|

|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<br>
|
|
12
12
|
[](https://github.com/pixeltable/pixeltable/actions/workflows/pytest.yml)
|
|
13
13
|
[](https://github.com/pixeltable/pixeltable/actions/workflows/nightly.yml)
|
|
14
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fpixeltable%2Fpixeltable?ref=badge_shield&issueType=security)
|
|
15
14
|
[](https://pypi.org/project/pixeltable/)
|
|
15
|
+
[](https://discord.gg/QPyqFYx2UN)
|
|
16
16
|
<a target="_blank" href="https://huggingface.co/Pixeltable">
|
|
17
17
|
<img src="https://img.shields.io/badge/🤗-HF Space-FF7D04" alt="Visit our Hugging Face space"/>
|
|
18
18
|
</a>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# These version placeholders will be replaced during build.
|
|
2
|
-
__version__ = "0.2.
|
|
3
|
-
__version_tuple__ = (0, 2,
|
|
2
|
+
__version__ = "0.2.25"
|
|
3
|
+
__version_tuple__ = (0, 2, 25)
|
|
@@ -28,6 +28,7 @@ from .globals import _ROWID_COLUMN_NAME, UpdateStatus, is_system_column_name, is
|
|
|
28
28
|
from .schema_object import SchemaObject
|
|
29
29
|
from .table_version import TableVersion
|
|
30
30
|
from .table_version_path import TableVersionPath
|
|
31
|
+
from ..exprs import ColumnRef
|
|
31
32
|
|
|
32
33
|
if TYPE_CHECKING:
|
|
33
34
|
import torch.utils.data
|
|
@@ -199,6 +200,7 @@ class Table(SchemaObject):
|
|
|
199
200
|
) -> 'pxt.dataframe.DataFrameResultSet':
|
|
200
201
|
"""Return rows from this table.
|
|
201
202
|
"""
|
|
203
|
+
self._check_is_dropped()
|
|
202
204
|
return self._df().show(*args, **kwargs)
|
|
203
205
|
|
|
204
206
|
def head(
|
|
@@ -298,6 +300,10 @@ class Table(SchemaObject):
|
|
|
298
300
|
return self._description_html()._repr_html_() # type: ignore[attr-defined]
|
|
299
301
|
|
|
300
302
|
def _drop(self) -> None:
|
|
303
|
+
cat = catalog.Catalog.get()
|
|
304
|
+
# verify all dependents are deleted by now
|
|
305
|
+
for dep in cat.tbl_dependents[self._id]:
|
|
306
|
+
assert dep._is_dropped
|
|
301
307
|
self._check_is_dropped()
|
|
302
308
|
self._tbl_version.drop()
|
|
303
309
|
self._is_dropped = True
|
|
@@ -598,31 +604,49 @@ class Table(SchemaObject):
|
|
|
598
604
|
cls._verify_column(col, column_names)
|
|
599
605
|
column_names.add(col.name)
|
|
600
606
|
|
|
601
|
-
def
|
|
607
|
+
def __check_column_name_exists(self, column_name: str, include_bases: bool = False) -> None:
|
|
608
|
+
col = self._tbl_version_path.get_column(column_name, include_bases)
|
|
609
|
+
if col is None:
|
|
610
|
+
raise excs.Error(f'Column {column_name!r} unknown')
|
|
611
|
+
|
|
612
|
+
def __check_column_ref_exists(self, col_ref: ColumnRef, include_bases: bool = False) -> None:
|
|
613
|
+
exists = self._tbl_version_path.has_column(col_ref.col, include_bases)
|
|
614
|
+
if not exists:
|
|
615
|
+
raise excs.Error(f'Unknown column: {col_ref.col.qualified_name}')
|
|
616
|
+
|
|
617
|
+
def drop_column(self, column: Union[str, ColumnRef]) -> None:
|
|
602
618
|
"""Drop a column from the table.
|
|
603
619
|
|
|
604
620
|
Args:
|
|
605
|
-
|
|
621
|
+
column: The name or reference of the column to drop.
|
|
606
622
|
|
|
607
623
|
Raises:
|
|
608
624
|
Error: If the column does not exist or if it is referenced by a dependent computed column.
|
|
609
625
|
|
|
610
626
|
Examples:
|
|
611
|
-
Drop the column `col` from the table `my_table
|
|
627
|
+
Drop the column `col` from the table `my_table` by column name:
|
|
612
628
|
|
|
613
629
|
>>> tbl = pxt.get_table('my_table')
|
|
614
630
|
... tbl.drop_column('col')
|
|
631
|
+
|
|
632
|
+
Drop the column `col` from the table `my_table` by column reference:
|
|
633
|
+
|
|
634
|
+
>>> tbl = pxt.get_table('my_table')
|
|
635
|
+
... tbl.drop_column(tbl.col)
|
|
615
636
|
"""
|
|
616
637
|
self._check_is_dropped()
|
|
617
|
-
|
|
618
|
-
if
|
|
619
|
-
|
|
620
|
-
|
|
638
|
+
col: Column = None
|
|
639
|
+
if isinstance(column, str):
|
|
640
|
+
self.__check_column_name_exists(column)
|
|
641
|
+
col = self._tbl_version.cols_by_name[column]
|
|
642
|
+
else:
|
|
643
|
+
self.__check_column_ref_exists(column)
|
|
644
|
+
col = column.col
|
|
621
645
|
|
|
622
646
|
dependent_user_cols = [c for c in col.dependent_cols if c.name is not None]
|
|
623
647
|
if len(dependent_user_cols) > 0:
|
|
624
648
|
raise excs.Error(
|
|
625
|
-
f'Cannot drop column `{name}` because the following columns depend on it:\n'
|
|
649
|
+
f'Cannot drop column `{col.name}` because the following columns depend on it:\n'
|
|
626
650
|
f'{", ".join(c.name for c in dependent_user_cols)}'
|
|
627
651
|
)
|
|
628
652
|
|
|
@@ -640,7 +664,7 @@ class Table(SchemaObject):
|
|
|
640
664
|
for view, store in dependent_stores
|
|
641
665
|
]
|
|
642
666
|
raise excs.Error(
|
|
643
|
-
f'Cannot drop column `{name}` because the following external stores depend on it:\n'
|
|
667
|
+
f'Cannot drop column `{col.name}` because the following external stores depend on it:\n'
|
|
644
668
|
f'{", ".join(dependent_store_names)}'
|
|
645
669
|
)
|
|
646
670
|
|
|
@@ -666,7 +690,7 @@ class Table(SchemaObject):
|
|
|
666
690
|
self._tbl_version.rename_column(old_name, new_name)
|
|
667
691
|
|
|
668
692
|
def add_embedding_index(
|
|
669
|
-
self,
|
|
693
|
+
self, column: Union[str, ColumnRef], *, idx_name: Optional[str] = None,
|
|
670
694
|
string_embed: Optional[pxt.Function] = None, image_embed: Optional[pxt.Function] = None,
|
|
671
695
|
metric: str = 'cosine'
|
|
672
696
|
) -> None:
|
|
@@ -680,7 +704,7 @@ class Table(SchemaObject):
|
|
|
680
704
|
of text over an image column.
|
|
681
705
|
|
|
682
706
|
Args:
|
|
683
|
-
|
|
707
|
+
column: The name of, or reference to, the column to index; must be a `String` or `Image` column.
|
|
684
708
|
idx_name: The name of index. If not specified, a name such as `'idx0'` will be generated automatically.
|
|
685
709
|
If specified, the name must be unique for this table.
|
|
686
710
|
string_embed: A function to embed text; required if the column is a `String` column.
|
|
@@ -692,11 +716,15 @@ class Table(SchemaObject):
|
|
|
692
716
|
Error: If an index with that name already exists for the table, or if the specified column does not exist.
|
|
693
717
|
|
|
694
718
|
Examples:
|
|
695
|
-
Add an index to the `img` column of the table `my_table
|
|
719
|
+
Add an index to the `img` column of the table `my_table` by column name:
|
|
696
720
|
|
|
697
721
|
>>> tbl = pxt.get_table('my_table')
|
|
698
722
|
... tbl.add_embedding_index('img', image_embed=my_image_func)
|
|
699
723
|
|
|
724
|
+
Add an index to the `img` column of the table `my_table` by column reference:
|
|
725
|
+
>>> tbl = pxt.get_table('my_table')
|
|
726
|
+
... tbl.add_embedding_index(tbl.img, image_embed=my_image_func)
|
|
727
|
+
|
|
700
728
|
Add another index to the `img` column, using the inner product as the distance metric,
|
|
701
729
|
and with a specific name; `string_embed` is also specified in order to search with text:
|
|
702
730
|
|
|
@@ -707,13 +735,28 @@ class Table(SchemaObject):
|
|
|
707
735
|
... string_embed=my_string_func,
|
|
708
736
|
... metric='ip'
|
|
709
737
|
... )
|
|
738
|
+
|
|
739
|
+
Alternatively:
|
|
740
|
+
|
|
741
|
+
>>> tbl.add_embedding_index(
|
|
742
|
+
... tbl.img,
|
|
743
|
+
... idx_name='clip_idx',
|
|
744
|
+
... image_embed=my_image_func,
|
|
745
|
+
... string_embed=my_string_func,
|
|
746
|
+
... metric='ip'
|
|
747
|
+
... )
|
|
710
748
|
"""
|
|
711
749
|
if self._tbl_version_path.is_snapshot():
|
|
712
750
|
raise excs.Error('Cannot add an index to a snapshot')
|
|
713
751
|
self._check_is_dropped()
|
|
714
|
-
col
|
|
715
|
-
if
|
|
716
|
-
|
|
752
|
+
col: Column
|
|
753
|
+
if isinstance(column, str):
|
|
754
|
+
self.__check_column_name_exists(column, include_bases=True)
|
|
755
|
+
col = self._tbl_version_path.get_column(column, include_bases=True)
|
|
756
|
+
else:
|
|
757
|
+
self.__check_column_ref_exists(column, include_bases=True)
|
|
758
|
+
col = column.col
|
|
759
|
+
|
|
717
760
|
if idx_name is not None and idx_name in self._tbl_version.idxs_by_name:
|
|
718
761
|
raise excs.Error(f'Duplicate index name: {idx_name}')
|
|
719
762
|
from pixeltable.index import EmbeddingIndex
|
|
@@ -724,82 +767,129 @@ class Table(SchemaObject):
|
|
|
724
767
|
# TODO: how to deal with exceptions here? drop the index and raise?
|
|
725
768
|
FileCache.get().emit_eviction_warnings()
|
|
726
769
|
|
|
727
|
-
def drop_embedding_index(
|
|
770
|
+
def drop_embedding_index(
|
|
771
|
+
self, *,
|
|
772
|
+
column: Union[str, ColumnRef, None] = None,
|
|
773
|
+
idx_name: Optional[str] = None) -> None:
|
|
728
774
|
"""
|
|
729
775
|
Drop an embedding index from the table. Either a column name or an index name (but not both) must be
|
|
730
|
-
specified. If a column name is specified, it must be a column containing exactly one
|
|
731
|
-
otherwise the specific index name must be provided instead.
|
|
776
|
+
specified. If a column name or reference is specified, it must be a column containing exactly one
|
|
777
|
+
embedding index; otherwise the specific index name must be provided instead.
|
|
732
778
|
|
|
733
779
|
Args:
|
|
734
|
-
|
|
735
|
-
|
|
780
|
+
column: The name of, or reference to, the column from which to drop the index.
|
|
781
|
+
The column must have only one embedding index.
|
|
736
782
|
idx_name: The name of the index to drop.
|
|
737
783
|
|
|
738
784
|
Raises:
|
|
739
|
-
Error: If `
|
|
785
|
+
Error: If `column` is specified, but the column does not exist, or it contains no embedding
|
|
740
786
|
indices or multiple embedding indices.
|
|
741
787
|
Error: If `idx_name` is specified, but the index does not exist or is not an embedding index.
|
|
742
788
|
|
|
743
789
|
Examples:
|
|
744
|
-
Drop the embedding index on the `img` column of the table `my_table
|
|
790
|
+
Drop the embedding index on the `img` column of the table `my_table` by column name:
|
|
745
791
|
|
|
746
792
|
>>> tbl = pxt.get_table('my_table')
|
|
747
|
-
... tbl.drop_embedding_index(
|
|
748
|
-
|
|
749
|
-
|
|
793
|
+
... tbl.drop_embedding_index(column='img')
|
|
794
|
+
|
|
795
|
+
Drop the embedding index on the `img` column of the table `my_table` by column reference:
|
|
796
|
+
|
|
797
|
+
>>> tbl = pxt.get_table('my_table')
|
|
798
|
+
... tbl.drop_embedding_index(column=tbl.img)
|
|
799
|
+
|
|
800
|
+
Drop the embedding index `idx1` of the table `my_table` by index name:
|
|
801
|
+
>>> tbl = pxt.get_table('my_table')
|
|
802
|
+
... tbl.drop_embedding_index(idx_name='idx1')
|
|
750
803
|
|
|
751
|
-
|
|
804
|
+
"""
|
|
805
|
+
if (column is None) == (idx_name is None):
|
|
806
|
+
raise excs.Error("Exactly one of 'column' or 'idx_name' must be provided")
|
|
807
|
+
|
|
808
|
+
col: Column = None
|
|
809
|
+
if idx_name is None:
|
|
810
|
+
if isinstance(column, str):
|
|
811
|
+
self.__check_column_name_exists(column, include_bases=True)
|
|
812
|
+
col = self._tbl_version_path.get_column(column, include_bases=True)
|
|
813
|
+
else:
|
|
814
|
+
self.__check_column_ref_exists(column, include_bases=True)
|
|
815
|
+
col = column.col
|
|
816
|
+
assert col is not None
|
|
817
|
+
self._drop_index(col=col, idx_name=idx_name, _idx_class=index.EmbeddingIndex)
|
|
818
|
+
|
|
819
|
+
def drop_index(
|
|
820
|
+
self, *,
|
|
821
|
+
column: Union[str, ColumnRef, None] = None,
|
|
822
|
+
idx_name: Optional[str] = None) -> None:
|
|
752
823
|
"""
|
|
753
824
|
Drop an index from the table. Either a column name or an index name (but not both) must be
|
|
754
|
-
specified. If a column name is specified, it must be a column containing exactly one index;
|
|
825
|
+
specified. If a column name or reference is specified, it must be a column containing exactly one index;
|
|
755
826
|
otherwise the specific index name must be provided instead.
|
|
756
827
|
|
|
757
828
|
Args:
|
|
758
|
-
|
|
759
|
-
|
|
829
|
+
column: The name of, or reference to, the column from which to drop the index.
|
|
830
|
+
The column must have only one embedding index.
|
|
760
831
|
idx_name: The name of the index to drop.
|
|
761
832
|
|
|
762
833
|
Raises:
|
|
763
|
-
Error: If `
|
|
834
|
+
Error: If `column` is specified, but the column does not exist, or it contains no
|
|
764
835
|
indices or multiple indices.
|
|
765
836
|
Error: If `idx_name` is specified, but the index does not exist.
|
|
766
837
|
|
|
767
838
|
Examples:
|
|
768
|
-
Drop the index on the `img` column of the table `my_table
|
|
839
|
+
Drop the index on the `img` column of the table `my_table` by column name:
|
|
769
840
|
|
|
770
841
|
>>> tbl = pxt.get_table('my_table')
|
|
771
842
|
... tbl.drop_index(column_name='img')
|
|
843
|
+
|
|
844
|
+
Drop the index on the `img` column of the table `my_table` by column reference:
|
|
845
|
+
|
|
846
|
+
>>> tbl = pxt.get_table('my_table')
|
|
847
|
+
... tbl.drop_index(tbl.img)
|
|
848
|
+
|
|
849
|
+
Drop the index `idx1` of the table `my_table` by index name:
|
|
850
|
+
>>> tbl = pxt.get_table('my_table')
|
|
851
|
+
... tbl.drop_index(idx_name='idx1')
|
|
852
|
+
|
|
772
853
|
"""
|
|
773
|
-
|
|
854
|
+
if (column is None) == (idx_name is None):
|
|
855
|
+
raise excs.Error("Exactly one of 'column' or 'idx_name' must be provided")
|
|
856
|
+
|
|
857
|
+
col: Column = None
|
|
858
|
+
if idx_name is None:
|
|
859
|
+
if isinstance(column, str):
|
|
860
|
+
self.__check_column_name_exists(column, include_bases=True)
|
|
861
|
+
col = self._tbl_version_path.get_column(column, include_bases=True)
|
|
862
|
+
else:
|
|
863
|
+
self.__check_column_ref_exists(column, include_bases=True)
|
|
864
|
+
col = column.col
|
|
865
|
+
assert col is not None
|
|
866
|
+
self._drop_index(col=col, idx_name=idx_name)
|
|
774
867
|
|
|
775
868
|
def _drop_index(
|
|
776
|
-
self, *,
|
|
869
|
+
self, *, col: Optional[Column] = None,
|
|
870
|
+
idx_name: Optional[str] = None,
|
|
777
871
|
_idx_class: Optional[type[index.IndexBase]] = None
|
|
778
872
|
) -> None:
|
|
779
873
|
if self._tbl_version_path.is_snapshot():
|
|
780
874
|
raise excs.Error('Cannot drop an index from a snapshot')
|
|
781
875
|
self._check_is_dropped()
|
|
782
|
-
|
|
783
|
-
raise excs.Error("Exactly one of 'column_name' or 'idx_name' must be provided")
|
|
876
|
+
assert (col is None) != (idx_name is None)
|
|
784
877
|
|
|
785
878
|
if idx_name is not None:
|
|
786
879
|
if idx_name not in self._tbl_version.idxs_by_name:
|
|
787
880
|
raise excs.Error(f'Index {idx_name!r} does not exist')
|
|
788
881
|
idx_id = self._tbl_version.idxs_by_name[idx_name].id
|
|
789
882
|
else:
|
|
790
|
-
col = self._tbl_version_path.get_column(column_name, include_bases=True)
|
|
791
|
-
if col is None:
|
|
792
|
-
raise excs.Error(f'Column {column_name!r} unknown')
|
|
793
883
|
if col.tbl.id != self._tbl_version.id:
|
|
794
884
|
raise excs.Error(
|
|
795
|
-
f'Column {
|
|
885
|
+
f'Column {col.name!r}: cannot drop index from column that belongs to base ({col.tbl.name}!r)')
|
|
796
886
|
idx_info = [info for info in self._tbl_version.idxs_by_name.values() if info.col.id == col.id]
|
|
797
887
|
if _idx_class is not None:
|
|
798
888
|
idx_info = [info for info in idx_info if isinstance(info.idx, _idx_class)]
|
|
799
889
|
if len(idx_info) == 0:
|
|
800
|
-
raise excs.Error(f'Column {
|
|
890
|
+
raise excs.Error(f'Column {col.name!r} does not have an index')
|
|
801
891
|
if len(idx_info) > 1:
|
|
802
|
-
raise excs.Error(f"Column {
|
|
892
|
+
raise excs.Error(f"Column {col.name!r} has multiple indices; specify 'idx_name' instead")
|
|
803
893
|
idx_id = idx_info[0].id
|
|
804
894
|
self._tbl_version.drop_index(idx_id)
|
|
805
895
|
|
|
@@ -194,6 +194,9 @@ class View(Table):
|
|
|
194
194
|
|
|
195
195
|
def _drop(self) -> None:
|
|
196
196
|
cat = catalog.Catalog.get()
|
|
197
|
+
# verify all dependents are deleted by now
|
|
198
|
+
for dep in cat.tbl_dependents[self._id]:
|
|
199
|
+
assert dep._is_dropped
|
|
197
200
|
if self._snapshot_only:
|
|
198
201
|
# there is not TableVersion to drop
|
|
199
202
|
self._check_is_dropped()
|
|
@@ -58,6 +58,9 @@ class SimilarityExpr(Expr):
|
|
|
58
58
|
def __str__(self) -> str:
|
|
59
59
|
return f'{self.components[0]}.similarity({self.components[1]})'
|
|
60
60
|
|
|
61
|
+
def default_column_name(self) -> str:
|
|
62
|
+
return 'similarity'
|
|
63
|
+
|
|
61
64
|
def sql_expr(self, _: SqlElementCache) -> Optional[sql.ColumnElement]:
|
|
62
65
|
if not isinstance(self.components[1], Literal):
|
|
63
66
|
raise excs.Error(f'similarity(): requires a string or a PIL.Image.Image object, not an expression')
|
|
@@ -3,16 +3,20 @@ from __future__ import annotations
|
|
|
3
3
|
import abc
|
|
4
4
|
import importlib
|
|
5
5
|
import inspect
|
|
6
|
-
from typing import Any, Callable, Optional
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Callable, Optional
|
|
7
7
|
|
|
8
8
|
import sqlalchemy as sql
|
|
9
9
|
|
|
10
10
|
import pixeltable as pxt
|
|
11
|
+
import pixeltable.exceptions as excs
|
|
11
12
|
import pixeltable.type_system as ts
|
|
12
13
|
|
|
13
14
|
from .globals import resolve_symbol
|
|
14
15
|
from .signature import Signature
|
|
15
16
|
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from .expr_template_function import ExprTemplateFunction
|
|
19
|
+
|
|
16
20
|
|
|
17
21
|
class Function(abc.ABC):
|
|
18
22
|
"""Base class for Pixeltable's function interface.
|
|
@@ -99,6 +103,38 @@ class Function(abc.ABC):
|
|
|
99
103
|
self._conditional_return_type = fn
|
|
100
104
|
return fn
|
|
101
105
|
|
|
106
|
+
def using(self, **kwargs: Any) -> 'ExprTemplateFunction':
|
|
107
|
+
from pixeltable import exprs
|
|
108
|
+
|
|
109
|
+
from .expr_template_function import ExprTemplateFunction
|
|
110
|
+
|
|
111
|
+
# Resolve each kwarg into a parameter binding
|
|
112
|
+
bindings: dict[str, exprs.Expr] = {}
|
|
113
|
+
for k, v in kwargs.items():
|
|
114
|
+
if k not in self.signature.parameters:
|
|
115
|
+
raise excs.Error(f'Unknown parameter: {k}')
|
|
116
|
+
param = self.signature.parameters[k]
|
|
117
|
+
expr = exprs.Expr.from_object(v)
|
|
118
|
+
if not param.col_type.is_supertype_of(expr.col_type):
|
|
119
|
+
raise excs.Error(f'Expected type `{param.col_type}` for parameter `{k}`; got `{expr.col_type}`')
|
|
120
|
+
bindings[k] = v # Use the original value, not the Expr (The Expr is only for validation)
|
|
121
|
+
|
|
122
|
+
residual_params = [
|
|
123
|
+
p for p in self.signature.parameters.values() if p.name not in bindings
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
# Bind each remaining parameter to a like-named variable
|
|
127
|
+
for param in residual_params:
|
|
128
|
+
bindings[param.name] = exprs.Variable(param.name, param.col_type)
|
|
129
|
+
|
|
130
|
+
call = exprs.FunctionCall(self, bindings)
|
|
131
|
+
|
|
132
|
+
# Construct the (n-k)-ary signature of the new function. We use `call.col_type` for this, rather than
|
|
133
|
+
# `self.signature.return_type`, because the return type of the new function may be specialized via a
|
|
134
|
+
# conditional return type.
|
|
135
|
+
new_signature = Signature(call.col_type, residual_params, self.signature.is_batched)
|
|
136
|
+
return ExprTemplateFunction(call, new_signature)
|
|
137
|
+
|
|
102
138
|
@abc.abstractmethod
|
|
103
139
|
def exec(self, *args: Any, **kwargs: Any) -> Any:
|
|
104
140
|
"""Execute the function with the given arguments and return the result."""
|
|
@@ -91,6 +91,7 @@ class Signature:
|
|
|
91
91
|
self.parameters_by_pos = parameters.copy()
|
|
92
92
|
self.constant_parameters = [p for p in parameters if not p.is_batched]
|
|
93
93
|
self.batched_parameters = [p for p in parameters if p.is_batched]
|
|
94
|
+
self.required_parameters = [p for p in parameters if not p.has_default()]
|
|
94
95
|
self.py_signature = inspect.Signature([p.to_py_param() for p in self.parameters_by_pos])
|
|
95
96
|
|
|
96
97
|
def get_return_type(self) -> ts.ColumnType:
|
|
@@ -36,7 +36,6 @@ def chat_completions(
|
|
|
36
36
|
temperature: Optional[float] = 0.7,
|
|
37
37
|
top_p: Optional[float] = 1.0,
|
|
38
38
|
max_tokens: Optional[int] = None,
|
|
39
|
-
min_tokens: Optional[int] = None,
|
|
40
39
|
stop: Optional[list[str]] = None,
|
|
41
40
|
random_seed: Optional[int] = None,
|
|
42
41
|
response_format: Optional[dict] = None,
|
|
@@ -75,7 +74,6 @@ def chat_completions(
|
|
|
75
74
|
temperature=temperature,
|
|
76
75
|
top_p=top_p,
|
|
77
76
|
max_tokens=_opt(max_tokens),
|
|
78
|
-
min_tokens=_opt(min_tokens),
|
|
79
77
|
stop=stop,
|
|
80
78
|
random_seed=_opt(random_seed),
|
|
81
79
|
response_format=response_format, # type: ignore[arg-type]
|
|
@@ -296,31 +296,42 @@ def move(path: str, new_path: str) -> None:
|
|
|
296
296
|
obj._move(new_p.name, new_dir._id)
|
|
297
297
|
|
|
298
298
|
|
|
299
|
-
def drop_table(
|
|
299
|
+
def drop_table(table: Union[str, catalog.Table], force: bool = False, ignore_errors: bool = False) -> None:
|
|
300
300
|
"""Drop a table, view, or snapshot.
|
|
301
301
|
|
|
302
302
|
Args:
|
|
303
|
-
|
|
303
|
+
table: Fully qualified name, or handle, of the table to be dropped.
|
|
304
304
|
force: If `True`, will also drop all views and sub-views of this table.
|
|
305
305
|
ignore_errors: If `True`, return silently if the table does not exist (without throwing an exception).
|
|
306
306
|
|
|
307
307
|
Raises:
|
|
308
|
-
Error: If the
|
|
308
|
+
Error: If the name does not exist or does not designate a table object, and `ignore_errors=False`.
|
|
309
309
|
|
|
310
310
|
Examples:
|
|
311
|
-
|
|
311
|
+
Drop a table by its fully qualified name:
|
|
312
|
+
>>> pxt.drop_table('subdir.my_table')
|
|
313
|
+
|
|
314
|
+
Drop a table by its handle:
|
|
315
|
+
>>> t = pxt.get_table('subdir.my_table')
|
|
316
|
+
... pxt.drop_table(t)
|
|
317
|
+
|
|
312
318
|
"""
|
|
313
319
|
cat = Catalog.get()
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
320
|
+
if isinstance(table, str):
|
|
321
|
+
tbl_path_obj = catalog.Path(table)
|
|
322
|
+
try:
|
|
323
|
+
cat.paths.check_is_valid(tbl_path_obj, expected=catalog.Table)
|
|
324
|
+
except Exception as e:
|
|
325
|
+
if ignore_errors or force:
|
|
326
|
+
_logger.info(f'Skipped table `{table}` (does not exist).')
|
|
327
|
+
return
|
|
328
|
+
else:
|
|
329
|
+
raise e
|
|
330
|
+
tbl = cat.paths[tbl_path_obj]
|
|
331
|
+
else:
|
|
332
|
+
tbl = table
|
|
333
|
+
tbl_path_obj = catalog.Path(tbl._path)
|
|
334
|
+
|
|
324
335
|
assert isinstance(tbl, catalog.Table)
|
|
325
336
|
if len(cat.tbl_dependents[tbl._id]) > 0:
|
|
326
337
|
dependent_paths = [dep._path for dep in cat.tbl_dependents[tbl._id]]
|
|
@@ -328,10 +339,10 @@ def drop_table(path: str, force: bool = False, ignore_errors: bool = False) -> N
|
|
|
328
339
|
for dependent_path in dependent_paths:
|
|
329
340
|
drop_table(dependent_path, force=True)
|
|
330
341
|
else:
|
|
331
|
-
raise excs.Error(f'Table {
|
|
342
|
+
raise excs.Error(f'Table {tbl._path} has dependents: {", ".join(dependent_paths)}')
|
|
332
343
|
tbl._drop()
|
|
333
|
-
del cat.paths[
|
|
334
|
-
_logger.info(f'Dropped table `{
|
|
344
|
+
del cat.paths[tbl_path_obj]
|
|
345
|
+
_logger.info(f'Dropped table `{tbl._path}`.')
|
|
335
346
|
|
|
336
347
|
|
|
337
348
|
def list_tables(dir_path: str = '', recursive: bool = True) -> list[str]:
|
|
@@ -136,7 +136,12 @@ class EmbeddingIndex(IndexBase):
|
|
|
136
136
|
"""Validate the signature"""
|
|
137
137
|
assert isinstance(embed_fn, func.Function)
|
|
138
138
|
sig = embed_fn.signature
|
|
139
|
-
|
|
139
|
+
|
|
140
|
+
# The embedding function must be a 1-ary function of the correct type. But it's ok if the function signature
|
|
141
|
+
# has more than one parameter, as long as it has at most one *required* parameter.
|
|
142
|
+
if (len(sig.parameters) == 0
|
|
143
|
+
or len(sig.required_parameters) > 1
|
|
144
|
+
or sig.parameters_by_pos[0].col_type.type_enum != expected_type):
|
|
140
145
|
raise excs.Error(
|
|
141
146
|
f'{name} must take a single {expected_type.name.lower()} parameter, but has signature {sig}')
|
|
142
147
|
|