18
18
19
19
import pytest
20
20
21
- from pyiceberg .catalog import Catalog , load_catalog
21
+ from pyiceberg .catalog import Catalog
22
22
from pyiceberg .exceptions import NoSuchTableError
23
23
from pyiceberg .partitioning import PartitionField , PartitionSpec
24
24
from pyiceberg .schema import Schema
41
41
)
42
42
43
43
44
- @pytest .fixture ()
45
- def catalog_rest () -> Catalog :
46
- return load_catalog (
47
- "local" ,
48
- ** {
49
- "type" : "rest" ,
50
- "uri" : "http://localhost:8181" ,
51
- "s3.endpoint" : "http://localhost:9000" ,
52
- "s3.access-key-id" : "admin" ,
53
- "s3.secret-access-key" : "password" ,
54
- },
55
- )
56
-
57
-
58
- @pytest .fixture ()
59
- def catalog_hive () -> Catalog :
60
- return load_catalog (
61
- "local" ,
62
- ** {
63
- "type" : "hive" ,
64
- "uri" : "http://localhost:9083" ,
65
- "s3.endpoint" : "http://localhost:9000" ,
66
- "s3.access-key-id" : "admin" ,
67
- "s3.secret-access-key" : "password" ,
68
- },
69
- )
70
-
71
-
72
44
def _simple_table (catalog : Catalog , table_schema_simple : Schema ) -> Table :
73
45
return _create_table_with_schema (catalog , table_schema_simple , "1" )
74
46
@@ -101,7 +73,7 @@ def _create_table_with_schema(catalog: Catalog, schema: Schema, format_version:
101
73
102
74
103
75
@pytest .mark .integration
104
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
76
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
105
77
def test_add_identity_partition (catalog : Catalog , table_schema_simple : Schema ) -> None :
106
78
simple_table = _simple_table (catalog , table_schema_simple )
107
79
simple_table .update_spec ().add_identity ("foo" ).commit ()
@@ -113,47 +85,47 @@ def test_add_identity_partition(catalog: Catalog, table_schema_simple: Schema) -
113
85
114
86
115
87
@pytest .mark .integration
116
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
88
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
117
89
def test_add_year (catalog : Catalog ) -> None :
118
90
table = _table (catalog )
119
91
table .update_spec ().add_field ("event_ts" , YearTransform (), "year_transform" ).commit ()
120
92
_validate_new_partition_fields (table , 1000 , 1 , 1000 , PartitionField (2 , 1000 , YearTransform (), "year_transform" ))
121
93
122
94
123
95
@pytest .mark .integration
124
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
96
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
125
97
def test_add_month (catalog : Catalog ) -> None :
126
98
table = _table (catalog )
127
99
table .update_spec ().add_field ("event_ts" , MonthTransform (), "month_transform" ).commit ()
128
100
_validate_new_partition_fields (table , 1000 , 1 , 1000 , PartitionField (2 , 1000 , MonthTransform (), "month_transform" ))
129
101
130
102
131
103
@pytest .mark .integration
132
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
104
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
133
105
def test_add_day (catalog : Catalog ) -> None :
134
106
table = _table (catalog )
135
107
table .update_spec ().add_field ("event_ts" , DayTransform (), "day_transform" ).commit ()
136
108
_validate_new_partition_fields (table , 1000 , 1 , 1000 , PartitionField (2 , 1000 , DayTransform (), "day_transform" ))
137
109
138
110
139
111
@pytest .mark .integration
140
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
112
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
141
113
def test_add_hour (catalog : Catalog ) -> None :
142
114
table = _table (catalog )
143
115
table .update_spec ().add_field ("event_ts" , HourTransform (), "hour_transform" ).commit ()
144
116
_validate_new_partition_fields (table , 1000 , 1 , 1000 , PartitionField (2 , 1000 , HourTransform (), "hour_transform" ))
145
117
146
118
147
119
@pytest .mark .integration
148
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
120
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
149
121
def test_add_bucket (catalog : Catalog , table_schema_simple : Schema ) -> None :
150
122
simple_table = _create_table_with_schema (catalog , table_schema_simple , "1" )
151
123
simple_table .update_spec ().add_field ("foo" , BucketTransform (12 ), "bucket_transform" ).commit ()
152
124
_validate_new_partition_fields (simple_table , 1000 , 1 , 1000 , PartitionField (1 , 1000 , BucketTransform (12 ), "bucket_transform" ))
153
125
154
126
155
127
@pytest .mark .integration
156
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
128
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
157
129
def test_add_truncate (catalog : Catalog , table_schema_simple : Schema ) -> None :
158
130
simple_table = _create_table_with_schema (catalog , table_schema_simple , "1" )
159
131
simple_table .update_spec ().add_field ("foo" , TruncateTransform (1 ), "truncate_transform" ).commit ()
@@ -163,7 +135,7 @@ def test_add_truncate(catalog: Catalog, table_schema_simple: Schema) -> None:
163
135
164
136
165
137
@pytest .mark .integration
166
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
138
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
167
139
def test_multiple_adds (catalog : Catalog ) -> None :
168
140
table = _table (catalog )
169
141
table .update_spec ().add_identity ("id" ).add_field ("event_ts" , HourTransform (), "hourly_partitioned" ).add_field (
@@ -181,7 +153,7 @@ def test_multiple_adds(catalog: Catalog) -> None:
181
153
182
154
183
155
@pytest .mark .integration
184
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
156
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
185
157
def test_add_hour_to_day (catalog : Catalog ) -> None :
186
158
table = _table (catalog )
187
159
table .update_spec ().add_field ("event_ts" , DayTransform (), "daily_partitioned" ).commit ()
@@ -197,7 +169,7 @@ def test_add_hour_to_day(catalog: Catalog) -> None:
197
169
198
170
199
171
@pytest .mark .integration
200
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
172
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
201
173
def test_add_multiple_buckets (catalog : Catalog ) -> None :
202
174
table = _table (catalog )
203
175
table .update_spec ().add_field ("id" , BucketTransform (16 )).add_field ("id" , BucketTransform (4 )).commit ()
@@ -212,7 +184,7 @@ def test_add_multiple_buckets(catalog: Catalog) -> None:
212
184
213
185
214
186
@pytest .mark .integration
215
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
187
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
216
188
def test_remove_identity (catalog : Catalog ) -> None :
217
189
table = _table (catalog )
218
190
table .update_spec ().add_identity ("id" ).commit ()
@@ -225,7 +197,7 @@ def test_remove_identity(catalog: Catalog) -> None:
225
197
226
198
227
199
@pytest .mark .integration
228
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
200
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
229
201
def test_remove_identity_v2 (catalog : Catalog ) -> None :
230
202
table_v2 = _table_v2 (catalog )
231
203
table_v2 .update_spec ().add_identity ("id" ).commit ()
@@ -236,7 +208,7 @@ def test_remove_identity_v2(catalog: Catalog) -> None:
236
208
237
209
238
210
@pytest .mark .integration
239
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
211
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
240
212
def test_remove_bucket (catalog : Catalog ) -> None :
241
213
table = _table (catalog )
242
214
with table .update_spec () as update :
@@ -257,7 +229,7 @@ def test_remove_bucket(catalog: Catalog) -> None:
257
229
258
230
259
231
@pytest .mark .integration
260
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
232
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
261
233
def test_remove_bucket_v2 (catalog : Catalog ) -> None :
262
234
table_v2 = _table_v2 (catalog )
263
235
with table_v2 .update_spec () as update :
@@ -272,7 +244,7 @@ def test_remove_bucket_v2(catalog: Catalog) -> None:
272
244
273
245
274
246
@pytest .mark .integration
275
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
247
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
276
248
def test_remove_day (catalog : Catalog ) -> None :
277
249
table = _table (catalog )
278
250
with table .update_spec () as update :
@@ -293,7 +265,7 @@ def test_remove_day(catalog: Catalog) -> None:
293
265
294
266
295
267
@pytest .mark .integration
296
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
268
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
297
269
def test_remove_day_v2 (catalog : Catalog ) -> None :
298
270
table_v2 = _table_v2 (catalog )
299
271
with table_v2 .update_spec () as update :
@@ -308,7 +280,7 @@ def test_remove_day_v2(catalog: Catalog) -> None:
308
280
309
281
310
282
@pytest .mark .integration
311
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
283
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
312
284
def test_rename (catalog : Catalog ) -> None :
313
285
table = _table (catalog )
314
286
table .update_spec ().add_identity ("id" ).commit ()
@@ -319,7 +291,7 @@ def test_rename(catalog: Catalog) -> None:
319
291
320
292
321
293
@pytest .mark .integration
322
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
294
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
323
295
def test_cannot_add_and_remove (catalog : Catalog ) -> None :
324
296
table = _table (catalog )
325
297
with pytest .raises (ValueError ) as exc_info :
@@ -328,7 +300,7 @@ def test_cannot_add_and_remove(catalog: Catalog) -> None:
328
300
329
301
330
302
@pytest .mark .integration
331
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
303
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
332
304
def test_cannot_add_redundant_time_partition (catalog : Catalog ) -> None :
333
305
table = _table (catalog )
334
306
with pytest .raises (ValueError ) as exc_info :
@@ -339,7 +311,7 @@ def test_cannot_add_redundant_time_partition(catalog: Catalog) -> None:
339
311
340
312
341
313
@pytest .mark .integration
342
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
314
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
343
315
def test_cannot_delete_and_rename (catalog : Catalog ) -> None :
344
316
table = _table (catalog )
345
317
with pytest .raises (ValueError ) as exc_info :
@@ -349,7 +321,7 @@ def test_cannot_delete_and_rename(catalog: Catalog) -> None:
349
321
350
322
351
323
@pytest .mark .integration
352
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
324
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
353
325
def test_cannot_rename_and_delete (catalog : Catalog ) -> None :
354
326
table = _table (catalog )
355
327
with pytest .raises (ValueError ) as exc_info :
@@ -359,7 +331,7 @@ def test_cannot_rename_and_delete(catalog: Catalog) -> None:
359
331
360
332
361
333
@pytest .mark .integration
362
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
334
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
363
335
def test_cannot_add_same_tranform_for_same_field (catalog : Catalog ) -> None :
364
336
table = _table (catalog )
365
337
with pytest .raises (ValueError ) as exc_info :
@@ -370,7 +342,7 @@ def test_cannot_add_same_tranform_for_same_field(catalog: Catalog) -> None:
370
342
371
343
372
344
@pytest .mark .integration
373
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
345
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
374
346
def test_cannot_add_same_field_multiple_times (catalog : Catalog ) -> None :
375
347
table = _table (catalog )
376
348
with pytest .raises (ValueError ) as exc_info :
@@ -381,7 +353,7 @@ def test_cannot_add_same_field_multiple_times(catalog: Catalog) -> None:
381
353
382
354
383
355
@pytest .mark .integration
384
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
356
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
385
357
def test_cannot_add_multiple_specs_same_name (catalog : Catalog ) -> None :
386
358
table = _table (catalog )
387
359
with pytest .raises (ValueError ) as exc_info :
@@ -392,7 +364,7 @@ def test_cannot_add_multiple_specs_same_name(catalog: Catalog) -> None:
392
364
393
365
394
366
@pytest .mark .integration
395
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
367
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
396
368
def test_change_specs_and_schema_transaction (catalog : Catalog ) -> None :
397
369
table = _table (catalog )
398
370
with table .transaction () as transaction :
@@ -425,7 +397,7 @@ def test_change_specs_and_schema_transaction(catalog: Catalog) -> None:
425
397
426
398
427
399
@pytest .mark .integration
428
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
400
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
429
401
def test_multiple_adds_and_remove_v1 (catalog : Catalog ) -> None :
430
402
table = _table (catalog )
431
403
with table .update_spec () as update :
@@ -447,7 +419,7 @@ def test_multiple_adds_and_remove_v1(catalog: Catalog) -> None:
447
419
448
420
449
421
@pytest .mark .integration
450
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
422
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
451
423
def test_multiple_adds_and_remove_v2 (catalog : Catalog ) -> None :
452
424
table_v2 = _table_v2 (catalog )
453
425
with table_v2 .update_spec () as update :
@@ -461,7 +433,7 @@ def test_multiple_adds_and_remove_v2(catalog: Catalog) -> None:
461
433
462
434
463
435
@pytest .mark .integration
464
- @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('catalog_hive ' ), pytest .lazy_fixture ('catalog_rest ' )])
436
+ @pytest .mark .parametrize ('catalog' , [pytest .lazy_fixture ('session_catalog_hive ' ), pytest .lazy_fixture ('session_catalog ' )])
465
437
def test_multiple_remove_and_add_reuses_v2 (catalog : Catalog ) -> None :
466
438
table_v2 = _table_v2 (catalog )
467
439
with table_v2 .update_spec () as update :
0 commit comments