From eb5881b80116685ee2bde1c99fc6adae7eedd86d Mon Sep 17 00:00:00 2001 From: Ally Heev Date: Mon, 1 Jun 2026 11:34:07 +0530 Subject: [PATCH 1/2] fix storage path --- icebug_format/cli.py | 9 +++------ icebug_format/graphar.py | 7 ++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/icebug_format/cli.py b/icebug_format/cli.py index e2915f0..4fcbfea 100644 --- a/icebug_format/cli.py +++ b/icebug_format/cli.py @@ -194,7 +194,6 @@ def generate_schema_cypher( parquet_dir: Path, edge_relationships: dict, node_type_to_table: dict, - storage_path: str, ) -> str: """ Generate schema.cypher content for ladybugdb. @@ -207,7 +206,6 @@ def generate_schema_cypher( parquet_dir: Path to the parquet output directory (for storage path) edge_relationships: Dict of edge relationships from schema node_type_to_table: Mapping of node types to table names - storage_path: Storage path string for schema.cypher Returns: String containing the schema.cypher content @@ -252,7 +250,7 @@ def get_edge_display_name(table_name: str) -> str: display_name = node_display_names[node_table] lines.append( f"CREATE NODE TABLE {display_name}({cols_str}, PRIMARY KEY({pk_col})) " - f"WITH (storage = '{storage_path}', format = 'icebug-disk');" + f"WITH (storage = '', format = 'icebug-disk');" ) except Exception as e: print( @@ -296,7 +294,7 @@ def get_edge_display_name(table_name: str) -> str: props_str = ", ".join(col_defs) lines.append( f"CREATE REL TABLE {rel_name}(FROM {src_table} TO {dst_table}" - f"{', ' + props_str if props_str else ''}) WITH (storage = '{storage_path}', format = 'icebug-disk');" + f"{', ' + props_str if props_str else ''}) WITH (storage = '', format = 'icebug-disk');" ) except Exception as e: print(f"Warning: Could not generate schema for rel table {rel_name}: {e}") @@ -379,8 +377,7 @@ def get_display_name(table_name: str, prefix: str) -> str: edge_tables, parquet_dir, edge_relationships, - node_type_to_table, - storage_path, + node_type_to_table ) schema_file = parquet_dir / "schema.cypher" schema_file.write_text(schema_cypher) diff --git a/icebug_format/graphar.py b/icebug_format/graphar.py index bba30b2..c98cbf7 100644 --- a/icebug_format/graphar.py +++ b/icebug_format/graphar.py @@ -469,9 +469,6 @@ def insert_relation(values): print(f"Parquet output directory: {parquet_dir}") - # Compute storage path (points to the parquet directory) - storage_path = f"./{parquet_dir.name}" - # Export node tables: nodes_.parquet for vertex_type, src_table in vertex_type_to_table.items(): csr_node_table = f"{csr_table_name}_{src_table}" @@ -514,7 +511,7 @@ def insert_relation(values): cols_str = ", ".join(col_defs) schema_lines.append( f"CREATE NODE TABLE {vertex_type}({cols_str}, PRIMARY KEY({pk_col})) " - f"WITH (storage = '{storage_path}', format = 'icebug-disk');" + f"WITH (storage = '', format = 'icebug-disk');" ) except Exception as e: print( @@ -542,7 +539,7 @@ def insert_relation(values): props_str = ", ".join(col_defs) schema_lines.append( f"CREATE REL TABLE {edge_type}(FROM {src_type} TO {dst_type}" - f"{', ' + props_str if props_str else ''}) WITH (storage = '{storage_path}', format = 'icebug-disk');" + f"{', ' + props_str if props_str else ''}) WITH (storage = '', format = 'icebug-disk');" ) except Exception as e: print(f"Warning: Could not generate schema for rel table {edge_type}: {e}") From b5bc316a5bab41c8f81f1025fed2174b6d525d36 Mon Sep 17 00:00:00 2001 From: Ally Heev Date: Tue, 2 Jun 2026 06:22:27 +0530 Subject: [PATCH 2/2] fix cli tests --- tests/test_cli.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index d9e3792..8e76696 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -363,7 +363,7 @@ def test_schema_path_maps_from_to_node_types(): schema_path = Path(tmpdir) / "in_schema.cypher" schema_path.write_text( - "CREATE REL TABLE livesin(FROM user TO city) WITH (storage='x', format='icebug-disk');\n" + "CREATE REL TABLE livesin(FROM user TO city) WITH (storage='', format='icebug-disk');\n" ) create_csr_graph_to_duckdb( @@ -399,22 +399,7 @@ def test_storage_path_appears_in_schema_cypher(): ) out_schema = (_parquet_dir(out) / "schema.cypher").read_text() - assert "./my_custom_store" in out_schema - - -def test_storage_path_default_uses_output_stem(): - """When storage_path is omitted the output DB stem is used as the default.""" - with tempfile.TemporaryDirectory() as tmpdir: - src = str(Path(tmpdir) / "src.duckdb") - out = str(Path(tmpdir) / "out.duckdb") - _make_source_db(src, [(0, 1)]) - - create_csr_graph_to_duckdb(src, out, add_reverse_edges=False, memory_limit=_MEM) - - out_schema = (_parquet_dir(out) / "schema.cypher").read_text() - # Default storage_path is "./out" (stem of out.duckdb) - assert "./out" in out_schema - + assert "storage = ''" in out_schema def test_default_csr_table_name_is_sql_safe(): assert default_csr_table_name("wikidata-20250625") == "wikidata_20250625"