Skip to content

Commit 926a8d2

Browse files
Merge branch 'apache:main' into python-3.12
2 parents 2bf908a + 0cbb71c commit 926a8d2

27 files changed

+1353
-437
lines changed

.github/workflows/python-ci-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v4
34-
- uses: actions/setup-python@v4
34+
- uses: actions/setup-python@v5
3535
with:
3636
python-version: ${{ matrix.python }}
3737
- name: Install

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- uses: actions/checkout@v4
4141
- name: Install poetry
4242
run: make install-poetry
43-
- uses: actions/setup-python@v4
43+
- uses: actions/setup-python@v5
4444
with:
4545
python-version: ${{ matrix.python }}
4646
cache: poetry

.github/workflows/python-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
with:
4242
fetch-depth: 0
4343

44-
- uses: actions/setup-python@v4
44+
- uses: actions/setup-python@v5
4545
with:
4646
python-version: '3.8'
4747

dev/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ENV PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.9.7-src.zip:$
3636
RUN mkdir -p ${HADOOP_HOME} && mkdir -p ${SPARK_HOME} && mkdir -p /home/iceberg/spark-events
3737
WORKDIR ${SPARK_HOME}
3838

39-
ENV SPARK_VERSION=3.4.1
39+
ENV SPARK_VERSION=3.4.2
4040
ENV ICEBERG_SPARK_RUNTIME_VERSION=3.4_2.12
4141
ENV ICEBERG_VERSION=1.4.0
4242
ENV AWS_SDK_VERSION=2.20.18

mkdocs/docs/api.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ catalog = load_catalog(
5454
)
5555
```
5656

57-
If the catalog has not been initialized before, you need to run:
58-
59-
```python
60-
catalog.create_tables()
61-
```
62-
6357
Let's create a namespace:
6458

6559
```python

mkdocs/docs/configuration.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ There are three ways to pass in configuration:
3232
- Through environment variables
3333
- By passing in credentials through the CLI or the Python API
3434

35-
The configuration file is recommended since that's the most transparent way. If you prefer environment configuration:
35+
The configuration file is recommended since that's the easiest way to manage the credentials.
36+
37+
Another option is through environment variables:
3638

3739
```sh
3840
export PYICEBERG_CATALOG__DEFAULT__URI=thrift://localhost:9083
41+
export PYICEBERG_CATALOG__DEFAULT__S3__ACCESS_KEY_ID=username
42+
export PYICEBERG_CATALOG__DEFAULT__S3__SECRET_ACCESS_KEY=password
3943
```
4044

41-
The environment variable picked up by Iceberg starts with `PYICEBERG_` and then follows the yaml structure below, where a double underscore `__` represents a nested field.
45+
The environment variable picked up by Iceberg starts with `PYICEBERG_` and then follows the yaml structure below, where a double underscore `__` represents a nested field, and the underscore `_` is converted into a dash `-`.
46+
47+
For example, `PYICEBERG_CATALOG__DEFAULT__S3__ACCESS_KEY_ID`, sets `s3.access-key-id` on the `default` catalog.
4248

4349
## FileIO
4450

@@ -80,8 +86,6 @@ For the FileIO there are several configuration options available:
8086

8187
### Azure Data lake
8288

83-
### Azure Data lake
84-
8589
| Key | Example | Description |
8690
| ----------------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
8791
| adlfs.connection-string | AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqF...;BlobEndpoint=http://localhost/ | A [connection string](https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string). This could be used to use FileIO with any adlfs-compatible object storage service that has a different endpoint (like [azurite](https://github.com/azure/azurite)). |

mkdocs/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
# under the License.
1717

1818
mkdocs==1.5.3
19-
griffe==0.38.0
19+
griffe==0.38.1
2020
jinja2==3.1.2
2121
mkdocstrings==0.24.0
2222
mkdocstrings-python==1.7.5
2323
mkdocs-literate-nav==0.6.1
2424
mkdocs-autorefs==0.5.0
2525
mkdocs-gen-files==0.5.0
26-
mkdocs-material==9.4.12
26+
mkdocs-material==9.4.14
2727
mkdocs-material-extensions==1.3.1
2828
mkdocs-section-index==0.3.8

poetry.lock

Lines changed: 234 additions & 235 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyiceberg/catalog/sql.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
union,
3232
update,
3333
)
34-
from sqlalchemy.exc import IntegrityError
34+
from sqlalchemy.exc import IntegrityError, OperationalError
3535
from sqlalchemy.orm import (
3636
DeclarativeBase,
3737
Mapped,
@@ -98,6 +98,18 @@ def __init__(self, name: str, **properties: str):
9898
raise NoSuchPropertyException("SQL connection URI is required")
9999
self.engine = create_engine(uri_prop, echo=True)
100100

101+
self._ensure_tables_exist()
102+
103+
def _ensure_tables_exist(self) -> None:
104+
with Session(self.engine) as session:
105+
for table in [IcebergTables, IcebergNamespaceProperties]:
106+
stmt = select(1).select_from(table)
107+
try:
108+
session.scalar(stmt)
109+
except OperationalError:
110+
self.create_tables()
111+
return
112+
101113
def create_tables(self) -> None:
102114
SqlCatalogBaseTable.metadata.create_all(self.engine)
103115

pyiceberg/cli/console.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,6 @@ def table(ctx: Context, identifier: str, property_name: str) -> None: # noqa: F
369369
catalog, output = _catalog_and_output(ctx)
370370
table = catalog.load_table(identifier)
371371
if property_name in table.metadata.properties:
372-
# We should think of the process here
373-
# Do we want something similar as in Java:
374-
# https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/Table.java#L178
375-
del table.metadata.properties
376372
output.exception(NotImplementedError("Writing is WIP"))
377373
ctx.exit(1)
378374
else:

0 commit comments

Comments
 (0)