@@ -384,3 +384,38 @@ def record(key):
384384
385385 assert 'aaa\n aaa\n aaa' == node .query (f"SELECT symbol FROM { CATALOG_NAME } .`{ namespace } .{ table_name } `" ).strip ()
386386 assert 'bbb\n bbb\n bbb' == node .query (f"SELECT symbol FROM { CATALOG_NAME } .`{ namespace } .{ table_name_2 } `" ).strip ()
387+
388+
389+ def test_table_with_slash (started_cluster ):
390+ node = started_cluster .instances ["node1" ]
391+
392+ # pyiceberg at current moment (version 0.9.1) has a bug with table names with slashes
393+ # see https://github.com/apache/iceberg-python/issues/2462
394+ # so we need to encode it manually
395+ table_raw_suffix = "table/foo"
396+ table_encoded_suffix = "table%2Ffoo"
397+
398+ test_ref = f"test_list_tables_{ uuid .uuid4 ()} "
399+ table_name = f"{ test_ref } _{ table_raw_suffix } "
400+ table_encoded_name = f"{ test_ref } _{ table_encoded_suffix } "
401+ root_namespace = f"{ test_ref } _namespace"
402+
403+ catalog = load_catalog_impl (started_cluster )
404+ catalog .create_namespace (root_namespace )
405+
406+ create_table (catalog , root_namespace , table_name , DEFAULT_SCHEMA , PartitionSpec (), DEFAULT_SORT_ORDER )
407+ table = catalog .load_table (f"{ root_namespace } .{ table_encoded_name } " )
408+ data = [
409+ {
410+ "datetime" : datetime .strptime ("2025-01-01 12:00:00" , "%Y-%m-%d %H:%M:%S" ),
411+ "symbol" : "AAPL" ,
412+ "bid" : 193.24 ,
413+ "ask" : 193.31 ,
414+ "details" : {"created_by" : "bot" },
415+ }
416+ ]
417+ df = pa .Table .from_pylist (data )
418+ table .append (df )
419+
420+ create_clickhouse_iceberg_database (started_cluster , node , CATALOG_NAME )
421+ assert node .query (f"SELECT * FROM { CATALOG_NAME } .`{ root_namespace } .{ table_encoded_name } `" ) == "2025-01-01 12:00:00.000000\t AAPL\t 193.24\t 193.31\t ('bot')\n "
0 commit comments