pixeltable 0.2.4__tar.gz → 0.2.6__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.4 → pixeltable-0.2.6}/PKG-INFO +14 -10
- {pixeltable-0.2.4 → pixeltable-0.2.6}/README.md +6 -5
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/__init__.py +18 -9
- pixeltable-0.2.6/pixeltable/__version__.py +3 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/column.py +31 -50
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/insertable_table.py +7 -6
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/table.py +171 -57
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/table_version.py +417 -140
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/table_version_path.py +2 -2
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/dataframe.py +239 -121
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/env.py +82 -16
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/__init__.py +2 -1
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/cache_prefetch_node.py +1 -1
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/data_row_batch.py +6 -7
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/expr_eval_node.py +28 -28
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/in_memory_data_node.py +11 -7
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/sql_scan_node.py +7 -6
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/__init__.py +4 -3
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/column_ref.py +9 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/comparison.py +3 -3
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/data_row.py +5 -1
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/expr.py +15 -7
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/function_call.py +17 -15
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/image_member_access.py +9 -28
- pixeltable-0.2.6/pixeltable/exprs/in_predicate.py +96 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/inline_array.py +13 -11
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/inline_dict.py +15 -13
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/literal.py +16 -4
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/row_builder.py +15 -41
- pixeltable-0.2.6/pixeltable/exprs/similarity_expr.py +65 -0
- pixeltable-0.2.6/pixeltable/ext/__init__.py +5 -0
- pixeltable-0.2.6/pixeltable/ext/functions/yolox.py +92 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/__init__.py +0 -2
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/aggregate_function.py +18 -15
- pixeltable-0.2.6/pixeltable/func/callable_function.py +113 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/expr_template_function.py +20 -3
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/function.py +35 -4
- pixeltable-0.2.6/pixeltable/func/globals.py +46 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/signature.py +23 -27
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/udf.py +13 -12
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/__init__.py +8 -8
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/eval.py +7 -8
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/huggingface.py +64 -17
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/openai.py +36 -3
- pixeltable-0.2.6/pixeltable/functions/pil/image.py +147 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/together.py +21 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/util.py +11 -0
- pixeltable-0.2.6/pixeltable/globals.py +425 -0
- pixeltable-0.2.6/pixeltable/index/__init__.py +2 -0
- pixeltable-0.2.6/pixeltable/index/base.py +51 -0
- pixeltable-0.2.6/pixeltable/index/embedding_index.py +168 -0
- pixeltable-0.2.6/pixeltable/io/__init__.py +3 -0
- {pixeltable-0.2.4/pixeltable/utils → pixeltable-0.2.6/pixeltable/io}/hf_datasets.py +48 -17
- pixeltable-0.2.6/pixeltable/io/pandas.py +148 -0
- {pixeltable-0.2.4/pixeltable/utils → pixeltable-0.2.6/pixeltable/io}/parquet.py +58 -33
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/iterators/__init__.py +1 -1
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/iterators/base.py +4 -0
- pixeltable-0.2.6/pixeltable/iterators/document.py +432 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/iterators/video.py +8 -9
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/metadata/__init__.py +7 -3
- pixeltable-0.2.6/pixeltable/metadata/converters/convert_12.py +3 -0
- pixeltable-0.2.6/pixeltable/metadata/converters/convert_13.py +41 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/metadata/schema.py +45 -22
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/plan.py +15 -51
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/store.py +38 -41
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/tool/create_test_db_dump.py +39 -4
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/type_system.py +47 -96
- pixeltable-0.2.6/pixeltable/utils/documents.py +69 -0
- pixeltable-0.2.6/pixeltable/utils/http_server.py +70 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pyproject.toml +34 -12
- pixeltable-0.2.4/pixeltable/client.py +0 -604
- pixeltable-0.2.4/pixeltable/exprs/image_similarity_predicate.py +0 -58
- pixeltable-0.2.4/pixeltable/func/batched_function.py +0 -53
- pixeltable-0.2.4/pixeltable/func/callable_function.py +0 -69
- pixeltable-0.2.4/pixeltable/func/globals.py +0 -36
- pixeltable-0.2.4/pixeltable/functions/pil/image.py +0 -150
- pixeltable-0.2.4/pixeltable/iterators/document.py +0 -311
- pixeltable-0.2.4/pixeltable/tests/conftest.py +0 -177
- pixeltable-0.2.4/pixeltable/tests/functions/test_fireworks.py +0 -42
- pixeltable-0.2.4/pixeltable/tests/functions/test_functions.py +0 -60
- pixeltable-0.2.4/pixeltable/tests/functions/test_huggingface.py +0 -158
- pixeltable-0.2.4/pixeltable/tests/functions/test_openai.py +0 -152
- pixeltable-0.2.4/pixeltable/tests/functions/test_together.py +0 -111
- pixeltable-0.2.4/pixeltable/tests/test_audio.py +0 -65
- pixeltable-0.2.4/pixeltable/tests/test_catalog.py +0 -27
- pixeltable-0.2.4/pixeltable/tests/test_client.py +0 -21
- pixeltable-0.2.4/pixeltable/tests/test_component_view.py +0 -370
- pixeltable-0.2.4/pixeltable/tests/test_dataframe.py +0 -439
- pixeltable-0.2.4/pixeltable/tests/test_dirs.py +0 -107
- pixeltable-0.2.4/pixeltable/tests/test_document.py +0 -120
- pixeltable-0.2.4/pixeltable/tests/test_exprs.py +0 -805
- pixeltable-0.2.4/pixeltable/tests/test_function.py +0 -324
- pixeltable-0.2.4/pixeltable/tests/test_migration.py +0 -43
- pixeltable-0.2.4/pixeltable/tests/test_nos.py +0 -54
- pixeltable-0.2.4/pixeltable/tests/test_snapshot.py +0 -208
- pixeltable-0.2.4/pixeltable/tests/test_table.py +0 -1267
- pixeltable-0.2.4/pixeltable/tests/test_transactional_directory.py +0 -42
- pixeltable-0.2.4/pixeltable/tests/test_types.py +0 -22
- pixeltable-0.2.4/pixeltable/tests/test_video.py +0 -159
- pixeltable-0.2.4/pixeltable/tests/test_view.py +0 -530
- pixeltable-0.2.4/pixeltable/tests/utils.py +0 -408
- pixeltable-0.2.4/pixeltable/utils/documents.py +0 -39
- {pixeltable-0.2.4 → pixeltable-0.2.6}/LICENSE +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/__init__.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/catalog.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/dir.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/globals.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/named_function.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/path.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/path_dict.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/schema_object.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/catalog/view.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exceptions.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/aggregation_node.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/component_iteration_node.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/exec_context.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/exec_node.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exec/media_validation_node.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/arithmetic_expr.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/array_slice.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/column_property_ref.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/compound_predicate.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/expr_set.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/globals.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/is_null.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/json_mapper.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/json_path.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/object_ref.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/predicate.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/rowid_ref.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/type_cast.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/exprs/variable.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/function_registry.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/func/nos_function.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/fireworks.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/image.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/string.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/functions/video.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/metadata/converters/convert_10.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/tool/create_test_video.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/__init__.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/arrow.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/clip.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/coco.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/filecache.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/help.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/media_store.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/pytorch.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/s3.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/pixeltable/utils/sql.py +0 -0
- {pixeltable-0.2.4 → pixeltable-0.2.6}/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.6
|
|
4
4
|
Summary: Pixeltable: The Multimodal AI Data Plane
|
|
5
5
|
Author: Marcel Kornacker
|
|
6
6
|
Author-email: marcelk@gmail.com
|
|
@@ -13,19 +13,22 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
13
13
|
Requires-Dist: av (>=10.0.0)
|
|
14
14
|
Requires-Dist: beautifulsoup4 (>=4.0.0,<5.0.0)
|
|
15
15
|
Requires-Dist: cloudpickle (>=2.2.1,<3.0.0)
|
|
16
|
+
Requires-Dist: ftfy (>=6.2.0,<7.0.0)
|
|
16
17
|
Requires-Dist: jinja2 (>=3.1.3,<4.0.0)
|
|
17
18
|
Requires-Dist: jmespath (>=1.0.1,<2.0.0)
|
|
18
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: mistune (>=3.0.2,<4.0.0)
|
|
20
|
+
Requires-Dist: numpy (>=1.25)
|
|
19
21
|
Requires-Dist: opencv-python-headless (>=4.7.0.68,<5.0.0.0)
|
|
20
22
|
Requires-Dist: pandas (>=2.0,<3.0)
|
|
21
|
-
Requires-Dist: pgserver (==0.1.
|
|
23
|
+
Requires-Dist: pgserver (==0.1.2)
|
|
22
24
|
Requires-Dist: pgvector (>=0.2.1,<0.3.0)
|
|
23
|
-
Requires-Dist: pillow (>=
|
|
25
|
+
Requires-Dist: pillow (>=9.3.0)
|
|
24
26
|
Requires-Dist: psutil (>=5.9.5,<6.0.0)
|
|
25
27
|
Requires-Dist: psycopg2-binary (>=2.9.5,<3.0.0)
|
|
28
|
+
Requires-Dist: pymupdf (>=1.24.1,<2.0.0)
|
|
26
29
|
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
27
|
-
Requires-Dist: regex (>=2022.10.31,<2023.0.0)
|
|
28
30
|
Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
31
|
+
Requires-Dist: setuptools (==69.1.1)
|
|
29
32
|
Requires-Dist: sqlalchemy-utils (>=0.41.1,<0.42.0)
|
|
30
33
|
Requires-Dist: sqlalchemy[mypy] (>=2.0.23,<3.0.0)
|
|
31
34
|
Requires-Dist: tenacity (>=8.2,<9.0)
|
|
@@ -33,13 +36,13 @@ Requires-Dist: tqdm (>=4.64.1,<5.0.0)
|
|
|
33
36
|
Description-Content-Type: text/markdown
|
|
34
37
|
|
|
35
38
|
<div align="center">
|
|
36
|
-
<img src="docs/pixeltable-banner.png" width="45%"/>
|
|
39
|
+
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/master/docs/pixeltable-banner.png" alt="Pixeltable" width="45%" />
|
|
37
40
|
|
|
38
41
|
# Unifying Data, Models, and Orchestration for AI Products
|
|
39
42
|
|
|
40
43
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
41
44
|
|
|
42
|
-

|
|
45
|
+
[](https://github.com/pixeltable/pixeltable/actions)
|
|
43
46
|
|
|
44
47
|
[Installation](https://pixeltable.github.io/pixeltable/getting-started/) | [Documentation](https://pixeltable.github.io/pixeltable/)
|
|
45
48
|
</div>
|
|
@@ -60,11 +63,12 @@ Learn the basics of Pixeltable through interactive examples. View the notebooks
|
|
|
60
63
|
### Pixeltable Basics
|
|
61
64
|
In this tutorial, we'll survey how to create tables, populate them with data, and enhance them with built-in and user-defined transformations and AI operations.
|
|
62
65
|
|
|
63
|
-
[](https://kaggle.com/kernels/welcome?src=https://github.com/pixeltable/pixeltable/blob/master/docs/tutorials/pixeltable-basics.ipynb)
|
|
67
|
+
<a target="_blank" href="https://colab.research.google.com/github/pixeltable/pixeltable/blob/master/docs/tutorials/pixeltable-basics.ipynb"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a>
|
|
64
68
|
|
|
65
69
|
|
|
66
70
|
## 💾 Installation
|
|
67
|
-
Pixeltable works with Python 3.9, 3.10, or 3.
|
|
71
|
+
Pixeltable works with Python 3.9, 3.10, 3.11, or 3.12 running on Linux, MacOS, or Windows.
|
|
68
72
|
|
|
69
73
|
```
|
|
70
74
|
pip install pixeltable
|
|
@@ -74,7 +78,7 @@ To verify that it's working:
|
|
|
74
78
|
|
|
75
79
|
```
|
|
76
80
|
import pixeltable as pxt
|
|
77
|
-
|
|
81
|
+
pxt.init()
|
|
78
82
|
```
|
|
79
83
|
|
|
80
84
|
For more detailed installation instructions, see the
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="docs/pixeltable-banner.png" width="45%"/>
|
|
2
|
+
<img src="https://raw.githubusercontent.com/pixeltable/pixeltable/master/docs/pixeltable-banner.png" alt="Pixeltable" width="45%" />
|
|
3
3
|
|
|
4
4
|
# Unifying Data, Models, and Orchestration for AI Products
|
|
5
5
|
|
|
6
6
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
7
|
|
|
8
|
-

|
|
8
|
+
[](https://github.com/pixeltable/pixeltable/actions)
|
|
9
9
|
|
|
10
10
|
[Installation](https://pixeltable.github.io/pixeltable/getting-started/) | [Documentation](https://pixeltable.github.io/pixeltable/)
|
|
11
11
|
</div>
|
|
@@ -26,11 +26,12 @@ Learn the basics of Pixeltable through interactive examples. View the notebooks
|
|
|
26
26
|
### Pixeltable Basics
|
|
27
27
|
In this tutorial, we'll survey how to create tables, populate them with data, and enhance them with built-in and user-defined transformations and AI operations.
|
|
28
28
|
|
|
29
|
-
[](https://kaggle.com/kernels/welcome?src=https://github.com/pixeltable/pixeltable/blob/master/docs/tutorials/pixeltable-basics.ipynb)
|
|
30
|
+
<a target="_blank" href="https://colab.research.google.com/github/pixeltable/pixeltable/blob/master/docs/tutorials/pixeltable-basics.ipynb"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a>
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
## 💾 Installation
|
|
33
|
-
Pixeltable works with Python 3.9, 3.10, or 3.
|
|
34
|
+
Pixeltable works with Python 3.9, 3.10, 3.11, or 3.12 running on Linux, MacOS, or Windows.
|
|
34
35
|
|
|
35
36
|
```
|
|
36
37
|
pip install pixeltable
|
|
@@ -40,7 +41,7 @@ To verify that it's working:
|
|
|
40
41
|
|
|
41
42
|
```
|
|
42
43
|
import pixeltable as pxt
|
|
43
|
-
|
|
44
|
+
pxt.init()
|
|
44
45
|
```
|
|
45
46
|
|
|
46
47
|
For more detailed installation instructions, see the
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
from .catalog import Column, Table, InsertableTable, View
|
|
2
|
-
from .client import Client
|
|
3
2
|
from .dataframe import DataFrame
|
|
4
3
|
from .exceptions import Error, Error
|
|
5
4
|
from .exprs import RELATIVE_PATH_ROOT
|
|
6
5
|
from .func import Function, udf, uda, Aggregator, expr_udf
|
|
7
|
-
from .
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
from .globals import *
|
|
7
|
+
from .type_system import (
|
|
8
|
+
ColumnType,
|
|
9
|
+
StringType,
|
|
10
|
+
IntType,
|
|
11
|
+
FloatType,
|
|
12
|
+
BoolType,
|
|
13
|
+
TimestampType,
|
|
14
|
+
JsonType,
|
|
15
|
+
ArrayType,
|
|
16
|
+
ImageType,
|
|
17
|
+
VideoType,
|
|
18
|
+
AudioType,
|
|
19
|
+
DocumentType,
|
|
20
|
+
)
|
|
10
21
|
from .utils.help import help
|
|
22
|
+
|
|
11
23
|
# noinspection PyUnresolvedReferences
|
|
12
|
-
from . import functions
|
|
24
|
+
from . import functions, io
|
|
25
|
+
from .__version__ import __version__, __version_tuple__
|
|
13
26
|
|
|
14
27
|
__all__ = [
|
|
15
|
-
'Client',
|
|
16
28
|
'DataFrame',
|
|
17
29
|
'Column',
|
|
18
30
|
'Table',
|
|
@@ -39,6 +51,3 @@ __all__ = [
|
|
|
39
51
|
'uda',
|
|
40
52
|
'expr_udf',
|
|
41
53
|
]
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
@@ -4,11 +4,9 @@ import logging
|
|
|
4
4
|
from typing import Optional, Union, Callable, Set
|
|
5
5
|
|
|
6
6
|
import sqlalchemy as sql
|
|
7
|
-
from pgvector.sqlalchemy import Vector
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from pixeltable.type_system import ColumnType, StringType
|
|
8
|
+
import pixeltable.exceptions as excs
|
|
9
|
+
import pixeltable.type_system as ts
|
|
12
10
|
from .globals import is_valid_identifier
|
|
13
11
|
|
|
14
12
|
_logger = logging.getLogger('pixeltable')
|
|
@@ -20,44 +18,38 @@ class Column:
|
|
|
20
18
|
table/view.
|
|
21
19
|
"""
|
|
22
20
|
def __init__(
|
|
23
|
-
self, name: str, col_type: Optional[ColumnType] = None,
|
|
21
|
+
self, name: Optional[str], col_type: Optional[ts.ColumnType] = None,
|
|
24
22
|
computed_with: Optional[Union['Expr', Callable]] = None,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
is_pk: bool = False, stored: Optional[bool] = None,
|
|
24
|
+
col_id: Optional[int] = None, schema_version_add: Optional[int] = None,
|
|
25
|
+
schema_version_drop: Optional[int] = None, sa_col_type: Optional[sql.sqltypes.TypeEngine] = None
|
|
26
|
+
):
|
|
29
27
|
"""Column constructor.
|
|
30
28
|
|
|
31
29
|
Args:
|
|
32
|
-
name: column name
|
|
30
|
+
name: column name; None for system columns (eg, index columns)
|
|
33
31
|
col_type: column type; can be None if the type can be derived from ``computed_with``
|
|
34
32
|
computed_with: a callable or an Expr object that computes the column value
|
|
35
|
-
|
|
33
|
+
is_pk: if True, this column is part of the primary key
|
|
36
34
|
stored: determines whether a computed column is present in the stored table or recomputed on demand
|
|
37
|
-
indexed: if True, this column has a nearest neighbor index (only valid for image columns)
|
|
38
35
|
col_id: column ID (only used internally)
|
|
39
36
|
|
|
40
37
|
Computed columns: those have a non-None ``computed_with`` argument
|
|
41
|
-
|
|
42
38
|
- when constructed by the user: ``computed_with`` was constructed explicitly and is passed in;
|
|
43
39
|
col_type is None
|
|
44
40
|
- when loaded from md store: ``computed_with`` is set and col_type is set
|
|
45
41
|
|
|
46
42
|
``computed_with`` is a Callable:
|
|
47
|
-
|
|
48
43
|
- the callable's parameter names must correspond to existing columns in the table for which this Column
|
|
49
44
|
is being used
|
|
50
45
|
- ``col_type`` needs to be set to the callable's return type
|
|
51
46
|
|
|
52
47
|
``stored`` (only valid for computed image columns):
|
|
53
|
-
|
|
54
48
|
- if True: the column is present in the stored table
|
|
55
49
|
- if False: the column is not present in the stored table and recomputed during a query
|
|
56
50
|
- if None: the system chooses for you (at present, this is always False, but this may change in the future)
|
|
57
|
-
|
|
58
|
-
indexed: only valid for image columns; if true, maintains an NN index for this column
|
|
59
51
|
"""
|
|
60
|
-
if not is_valid_identifier(name):
|
|
52
|
+
if name is not None and not is_valid_identifier(name):
|
|
61
53
|
raise excs.Error(f"Invalid column name: '{name}'")
|
|
62
54
|
self.name = name
|
|
63
55
|
if col_type is None and computed_with is None:
|
|
@@ -90,35 +82,20 @@ class Column:
|
|
|
90
82
|
self.stored = stored
|
|
91
83
|
self.dependent_cols: Set[Column] = set() # cols with value_exprs that reference us; set by TableVersion
|
|
92
84
|
self.id = col_id
|
|
93
|
-
self.
|
|
85
|
+
self.is_pk = is_pk
|
|
86
|
+
self.schema_version_add = schema_version_add
|
|
87
|
+
self.schema_version_drop = schema_version_drop
|
|
94
88
|
|
|
95
89
|
# column in the stored table for the values of this Column
|
|
96
90
|
self.sa_col: Optional[sql.schema.Column] = None
|
|
91
|
+
self.sa_col_type = sa_col_type
|
|
97
92
|
|
|
98
93
|
# computed cols also have storage columns for the exception string and type
|
|
99
94
|
self.sa_errormsg_col: Optional[sql.schema.Column] = None
|
|
100
95
|
self.sa_errortype_col: Optional[sql.schema.Column] = None
|
|
101
|
-
# indexed columns also have a column for the embeddings
|
|
102
|
-
self.sa_idx_col: Optional[sql.schema.Column] = None
|
|
103
96
|
from .table_version import TableVersion
|
|
104
97
|
self.tbl: Optional[TableVersion] = None # set by owning TableVersion
|
|
105
98
|
|
|
106
|
-
if indexed and not self.col_type.is_image_type():
|
|
107
|
-
raise excs.Error(f'Column {name}: indexed=True requires ImageType')
|
|
108
|
-
self.is_indexed = indexed
|
|
109
|
-
|
|
110
|
-
@classmethod
|
|
111
|
-
def from_md(cls, col_id: int, md: schema.SchemaColumn, tbl: 'TableVersion') -> Column:
|
|
112
|
-
"""Construct a Column from metadata.
|
|
113
|
-
|
|
114
|
-
Leaves out value_expr, because that requires TableVersion.cols to be complete.
|
|
115
|
-
"""
|
|
116
|
-
col = cls(
|
|
117
|
-
md.name, col_type=ColumnType.from_dict(md.col_type), primary_key=md.is_pk,
|
|
118
|
-
stored=md.stored, indexed=md.is_indexed, col_id=col_id)
|
|
119
|
-
col.tbl = tbl
|
|
120
|
-
return col
|
|
121
|
-
|
|
122
99
|
def __hash__(self) -> int:
|
|
123
100
|
assert self.tbl is not None
|
|
124
101
|
return hash((self.tbl.id, self.id))
|
|
@@ -137,6 +114,10 @@ class Column:
|
|
|
137
114
|
l = list(self.value_expr.subexprs(filter=lambda e: isinstance(e, exprs.FunctionCall) and e.is_window_fn_call))
|
|
138
115
|
return len(l) > 0
|
|
139
116
|
|
|
117
|
+
def get_idx_info(self) -> dict[str, 'pixeltable.catalog.TableVersion.IndexInfo']:
|
|
118
|
+
assert self.tbl is not None
|
|
119
|
+
return {name: info for name, info in self.tbl.idxs_by_name.items() if info.col == self}
|
|
120
|
+
|
|
140
121
|
@property
|
|
141
122
|
def is_computed(self) -> bool:
|
|
142
123
|
return self.compute_func is not None or self.value_expr is not None
|
|
@@ -167,26 +148,26 @@ class Column:
|
|
|
167
148
|
"""
|
|
168
149
|
assert self.is_stored
|
|
169
150
|
# all storage columns are nullable (we deal with null errors in Pixeltable directly)
|
|
170
|
-
self.sa_col = sql.Column(
|
|
151
|
+
self.sa_col = sql.Column(
|
|
152
|
+
self.store_name(), self.col_type.to_sa_type() if self.sa_col_type is None else self.sa_col_type,
|
|
153
|
+
nullable=True)
|
|
171
154
|
if self.is_computed or self.col_type.is_media_type():
|
|
172
|
-
self.sa_errormsg_col = sql.Column(self.
|
|
173
|
-
self.sa_errortype_col = sql.Column(self.
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
self.sa_errormsg_col = sql.Column(self.errormsg_store_name(), ts.StringType().to_sa_type(), nullable=True)
|
|
156
|
+
self.sa_errortype_col = sql.Column(self.errortype_store_name(), ts.StringType().to_sa_type(), nullable=True)
|
|
157
|
+
|
|
158
|
+
def get_sa_col_type(self) -> sql.sqltypes.TypeEngine:
|
|
159
|
+
return self.col_type.to_sa_type() if self.sa_col_type is None else self.sa_col_type
|
|
176
160
|
|
|
177
|
-
def
|
|
161
|
+
def store_name(self) -> str:
|
|
178
162
|
assert self.id is not None
|
|
179
163
|
assert self.is_stored
|
|
180
164
|
return f'col_{self.id}'
|
|
181
165
|
|
|
182
|
-
def
|
|
183
|
-
return f'{self.
|
|
184
|
-
|
|
185
|
-
def errortype_storage_name(self) -> str:
|
|
186
|
-
return f'{self.storage_name()}_errortype'
|
|
166
|
+
def errormsg_store_name(self) -> str:
|
|
167
|
+
return f'{self.store_name()}_errormsg'
|
|
187
168
|
|
|
188
|
-
def
|
|
189
|
-
return f'{self.
|
|
169
|
+
def errortype_store_name(self) -> str:
|
|
170
|
+
return f'{self.store_name()}_errortype'
|
|
190
171
|
|
|
191
172
|
def __str__(self) -> str:
|
|
192
173
|
return f'{self.name}: {self.col_type}'
|
|
@@ -11,14 +11,17 @@ import pixeltable.type_system as ts
|
|
|
11
11
|
from pixeltable import exceptions as excs
|
|
12
12
|
from pixeltable.env import Env
|
|
13
13
|
from .catalog import Catalog
|
|
14
|
+
from .globals import UpdateStatus
|
|
14
15
|
from .table import Table
|
|
15
16
|
from .table_version import TableVersion
|
|
16
17
|
from .table_version_path import TableVersionPath
|
|
17
18
|
|
|
18
19
|
_logger = logging.getLogger('pixeltable')
|
|
19
20
|
|
|
21
|
+
|
|
20
22
|
class InsertableTable(Table):
|
|
21
23
|
"""A `Table` that allows inserting and deleting rows."""
|
|
24
|
+
|
|
22
25
|
def __init__(self, dir_id: UUID, tbl_version: TableVersion):
|
|
23
26
|
tbl_version_path = TableVersionPath(tbl_version)
|
|
24
27
|
super().__init__(tbl_version.id, dir_id, tbl_version.name, tbl_version_path)
|
|
@@ -42,7 +45,7 @@ class InsertableTable(Table):
|
|
|
42
45
|
col = columns[column_names.index(pk_col)]
|
|
43
46
|
if col.col_type.nullable:
|
|
44
47
|
raise excs.Error(f'Primary key column {pk_col} cannot be nullable')
|
|
45
|
-
col.
|
|
48
|
+
col.is_pk = True
|
|
46
49
|
|
|
47
50
|
with orm.Session(Env.get().engine, future=True) as session:
|
|
48
51
|
_, tbl_version = TableVersion.create(session, dir_id, name, columns, num_retained_versions, comment)
|
|
@@ -62,7 +65,7 @@ class InsertableTable(Table):
|
|
|
62
65
|
@overload
|
|
63
66
|
def insert(self, print_stats: bool = False, fail_on_exception: bool = True, **kwargs: Any): ...
|
|
64
67
|
|
|
65
|
-
def insert(self, *args, **kwargs) ->
|
|
68
|
+
def insert(self, *args, **kwargs) -> UpdateStatus:
|
|
66
69
|
"""Insert rows into table.
|
|
67
70
|
|
|
68
71
|
To insert multiple rows at a time:
|
|
@@ -161,7 +164,7 @@ class InsertableTable(Table):
|
|
|
161
164
|
msg = str(e)
|
|
162
165
|
raise excs.Error(f'Error in column {col.name}: {msg[0].lower() + msg[1:]}\nRow: {row}')
|
|
163
166
|
|
|
164
|
-
def delete(self, where: Optional['pixeltable.exprs.Predicate'] = None) ->
|
|
167
|
+
def delete(self, where: Optional['pixeltable.exprs.Predicate'] = None) -> UpdateStatus:
|
|
165
168
|
"""Delete rows in this table.
|
|
166
169
|
|
|
167
170
|
Args:
|
|
@@ -181,9 +184,7 @@ class InsertableTable(Table):
|
|
|
181
184
|
if where is not None:
|
|
182
185
|
if not isinstance(where, Predicate):
|
|
183
186
|
raise excs.Error(f"'where' argument must be a Predicate, got {type(where)}")
|
|
184
|
-
analysis_info = Planner.analyze(self.
|
|
185
|
-
if analysis_info.similarity_clause is not None:
|
|
186
|
-
raise excs.Error('nearest() cannot be used with delete()')
|
|
187
|
+
analysis_info = Planner.analyze(self.tbl_version_path, where)
|
|
187
188
|
# for now we require that the updated rows can be identified via SQL, rather than via a Python filter
|
|
188
189
|
if analysis_info.filter is not None:
|
|
189
190
|
raise excs.Error(f'Filter {analysis_info.filter} not expressible in SQL')
|