|
3 | 3 |
|
4 | 4 | Tests in this file use a simple Iceberg catalog based on SQLite, with the same |
5 | 5 | data used for Parquet tests (``pandas/tests/io/data/parquet/simple.parquet``). |
6 | | -
|
7 | | -The next code has been used to generate the Iceberg catalog: |
8 | | -
|
9 | | -```python |
10 | | -import pyarrow.parquet as pq |
11 | | -from pyiceberg.catalog import load_catalog |
12 | | -
|
13 | | -warehouse = "pandas/tests/io/data/iceberg" |
14 | | -catalog = load_catalog( |
15 | | - "default", |
16 | | - **{ |
17 | | - "type": "sql", |
18 | | - "uri": f"sqlite:///{warehouse}/catalog.sqlite", |
19 | | - "warehouse": f"file://{warehouse}", |
20 | | - }, |
21 | | -) |
22 | | -catalog.create_namespace("default") |
23 | | -df = pq.read_table("pandas/tests/io/data/parquet/simple.parquet") |
24 | | -table = catalog.create_table("default.simple", schema=df.schema) |
25 | | -table.append(df) |
26 | | -``` |
27 | 6 | """ |
28 | 7 |
|
29 | 8 | from contextlib import contextmanager |
|
38 | 17 |
|
39 | 18 | from pandas.io.iceberg import read_iceberg |
40 | 19 |
|
41 | | - |
42 | | -# TODO: Remove this before merging |
43 | | -# Using to gather information about the CI errors that don't reproduce locally |
44 | | -import os |
45 | | -import pprint |
46 | | -import strictyaml |
47 | | - |
48 | | -PYICEBERG_HOME = "PYICEBERG_HOME" |
49 | | -search_dirs = [os.environ.get(PYICEBERG_HOME), os.path.expanduser("~"), os.getcwd()] |
50 | | -data = [".pyiceberg locations:"] |
51 | | -for dir_ in search_dirs: |
52 | | - path = None |
53 | | - exists = False |
54 | | - content = None |
55 | | - if dir_: |
56 | | - path = pathlib.Path(dir_) / ".pyiceberg.yaml" |
57 | | - exists = path.exists() |
58 | | - if exists: |
59 | | - with open(path, encoding="utf-8") as f: |
60 | | - yml_str = f.read() |
61 | | - content = strictyaml.load(yml_str).data |
62 | | - data.append((path, exists, content)) |
63 | | - |
64 | | -raise RuntimeError(pprint.pformat(data)) |
65 | | -# TODO end |
| 20 | +pytestmark = [pytest.mark.single_cpu] |
66 | 21 |
|
67 | 22 | pyiceberg = pytest.importorskip("pyiceberg") |
68 | 23 | pyiceberg_catalog = pytest.importorskip("pyiceberg.catalog") |
|
0 commit comments