ebyhr commented on code in PR #3414:
URL: https://github.com/apache/iceberg-python/pull/3414#discussion_r3353729774
##########
mkdocs/docs/api.md:
##########
@@ -1529,15 +1529,72 @@ cleanup_old_snapshots("analytics.user_events", [12345,
67890, 11111])
## Views
-PyIceberg supports view operations.
+If PyIceberg is unable to automatically determine view support on your REST
Catalog, you can manually specify, `"view-endpoints-supported": "true"`:
-### Check if a view exists
+```python
+from pyiceberg.catalog import load_catalog
+
+catalog = load_catalog(
+ "docs",
+ **{
+ "uri": "http://127.0.0.1:8181",
+ "py-io-impl": "pyiceberg.io.pyarrow.PyArrowFileIO",
Review Comment:
> py-io-impl
This is actually an optional parameter for views, right?
##########
mkdocs/docs/api.md:
##########
@@ -1529,15 +1529,72 @@ cleanup_old_snapshots("analytics.user_events", [12345,
67890, 11111])
## Views
-PyIceberg supports view operations.
+If PyIceberg is unable to automatically determine view support on your REST
Catalog, you can manually specify, `"view-endpoints-supported": "true"`:
-### Check if a view exists
+```python
+from pyiceberg.catalog import load_catalog
+
+catalog = load_catalog(
+ "docs",
+ **{
+ "uri": "http://127.0.0.1:8181",
+ "py-io-impl": "pyiceberg.io.pyarrow.PyArrowFileIO",
+ "s3.endpoint": "http://127.0.0.1:9000",
+ "s3.access-key-id": "admin",
+ "s3.secret-access-key": "password",
+ "view-endpoints-supported": "true",
+ }
+)
+```
+
+## Create a view
+
+To create a view from the catalog:
```python
+import time
from pyiceberg.catalog import load_catalog
+from pyiceberg.schema import Schema
+from pyiceberg.types import IntegerType, NestedField
+from pyiceberg.view import SQLViewRepresentation, ViewVersion
catalog = load_catalog("default")
-catalog.view_exists("default.bar")
+
+schema = Schema(NestedField(field_id=1, name="some_col",
field_type=IntegerType(), required=False))
+view_version = ViewVersion(
+ version_id=1,
+ schema_id=1,
+ timestamp_ms=int(time.time() * 1000),
+ summary={"engine-name": "spark", "engineVersion": "4.1"},
Review Comment:
nit: the summary field is expected to store the metadata created the object:
```suggestion
summary={"engine-name": "pyiceberg", "engine-version": "0.11.1"},
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]