real-ladybug 0.0.1.dev1__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of real-ladybug might be problematic. Click here for more details.

Files changed (114) hide show
  1. real_ladybug/__init__.py +83 -0
  2. real_ladybug/_lbug.cp311-win_amd64.pyd +0 -0
  3. real_ladybug/_lbug.exp +0 -0
  4. real_ladybug/_lbug.lib +0 -0
  5. real_ladybug/async_connection.py +226 -0
  6. real_ladybug/connection.py +323 -0
  7. real_ladybug/constants.py +7 -0
  8. real_ladybug/database.py +307 -0
  9. real_ladybug/prepared_statement.py +51 -0
  10. real_ladybug/py.typed +0 -0
  11. real_ladybug/query_result.py +511 -0
  12. real_ladybug/torch_geometric_feature_store.py +185 -0
  13. real_ladybug/torch_geometric_graph_store.py +131 -0
  14. real_ladybug/torch_geometric_result_converter.py +282 -0
  15. real_ladybug/types.py +39 -0
  16. real_ladybug-0.0.1.dev1.dist-info/METADATA +88 -0
  17. real_ladybug-0.0.1.dev1.dist-info/RECORD +114 -0
  18. real_ladybug-0.0.1.dev1.dist-info/WHEEL +5 -0
  19. real_ladybug-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
  20. real_ladybug-0.0.1.dev1.dist-info/top_level.txt +3 -0
  21. real_ladybug-0.0.1.dev1.dist-info/zip-safe +1 -0
  22. real_ladybug-source/scripts/antlr4/hash.py +2 -0
  23. real_ladybug-source/scripts/antlr4/keywordhandler.py +47 -0
  24. real_ladybug-source/scripts/collect-extensions.py +68 -0
  25. real_ladybug-source/scripts/collect-single-file-header.py +126 -0
  26. real_ladybug-source/scripts/export-dbs.py +101 -0
  27. real_ladybug-source/scripts/export-import-test.py +345 -0
  28. real_ladybug-source/scripts/extension/purge-beta.py +34 -0
  29. real_ladybug-source/scripts/generate-cpp-docs/collect_files.py +122 -0
  30. real_ladybug-source/scripts/generate-tinysnb.py +34 -0
  31. real_ladybug-source/scripts/get-clangd-diagnostics.py +233 -0
  32. real_ladybug-source/scripts/migrate-lbug-db.py +308 -0
  33. real_ladybug-source/scripts/multiplatform-test-helper/collect-results.py +71 -0
  34. real_ladybug-source/scripts/multiplatform-test-helper/notify-discord.py +68 -0
  35. real_ladybug-source/scripts/pip-package/package_tar.py +90 -0
  36. real_ladybug-source/scripts/pip-package/setup.py +130 -0
  37. real_ladybug-source/scripts/run-clang-format.py +408 -0
  38. real_ladybug-source/scripts/setup-extension-repo.py +67 -0
  39. real_ladybug-source/scripts/test-simsimd-dispatch.py +45 -0
  40. real_ladybug-source/scripts/update-nightly-build-version.py +81 -0
  41. real_ladybug-source/third_party/brotli/scripts/dictionary/step-01-download-rfc.py +16 -0
  42. real_ladybug-source/third_party/brotli/scripts/dictionary/step-02-rfc-to-bin.py +34 -0
  43. real_ladybug-source/third_party/brotli/scripts/dictionary/step-03-validate-bin.py +35 -0
  44. real_ladybug-source/third_party/brotli/scripts/dictionary/step-04-generate-java-literals.py +85 -0
  45. real_ladybug-source/third_party/pybind11/tools/codespell_ignore_lines_from_errors.py +35 -0
  46. real_ladybug-source/third_party/pybind11/tools/libsize.py +36 -0
  47. real_ladybug-source/third_party/pybind11/tools/make_changelog.py +63 -0
  48. real_ladybug-source/tools/python_api/build/real_ladybug/__init__.py +83 -0
  49. real_ladybug-source/tools/python_api/build/real_ladybug/async_connection.py +226 -0
  50. real_ladybug-source/tools/python_api/build/real_ladybug/connection.py +323 -0
  51. real_ladybug-source/tools/python_api/build/real_ladybug/constants.py +7 -0
  52. real_ladybug-source/tools/python_api/build/real_ladybug/database.py +307 -0
  53. real_ladybug-source/tools/python_api/build/real_ladybug/prepared_statement.py +51 -0
  54. real_ladybug-source/tools/python_api/build/real_ladybug/py.typed +0 -0
  55. real_ladybug-source/tools/python_api/build/real_ladybug/query_result.py +511 -0
  56. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_feature_store.py +185 -0
  57. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_graph_store.py +131 -0
  58. real_ladybug-source/tools/python_api/build/real_ladybug/torch_geometric_result_converter.py +282 -0
  59. real_ladybug-source/tools/python_api/build/real_ladybug/types.py +39 -0
  60. real_ladybug-source/tools/python_api/src_py/__init__.py +83 -0
  61. real_ladybug-source/tools/python_api/src_py/async_connection.py +226 -0
  62. real_ladybug-source/tools/python_api/src_py/connection.py +323 -0
  63. real_ladybug-source/tools/python_api/src_py/constants.py +7 -0
  64. real_ladybug-source/tools/python_api/src_py/database.py +307 -0
  65. real_ladybug-source/tools/python_api/src_py/prepared_statement.py +51 -0
  66. real_ladybug-source/tools/python_api/src_py/py.typed +0 -0
  67. real_ladybug-source/tools/python_api/src_py/query_result.py +511 -0
  68. real_ladybug-source/tools/python_api/src_py/torch_geometric_feature_store.py +185 -0
  69. real_ladybug-source/tools/python_api/src_py/torch_geometric_graph_store.py +131 -0
  70. real_ladybug-source/tools/python_api/src_py/torch_geometric_result_converter.py +282 -0
  71. real_ladybug-source/tools/python_api/src_py/types.py +39 -0
  72. real_ladybug-source/tools/python_api/test/conftest.py +230 -0
  73. real_ladybug-source/tools/python_api/test/disabled_test_extension.py +73 -0
  74. real_ladybug-source/tools/python_api/test/ground_truth.py +430 -0
  75. real_ladybug-source/tools/python_api/test/test_arrow.py +694 -0
  76. real_ladybug-source/tools/python_api/test/test_async_connection.py +159 -0
  77. real_ladybug-source/tools/python_api/test/test_blob_parameter.py +145 -0
  78. real_ladybug-source/tools/python_api/test/test_connection.py +49 -0
  79. real_ladybug-source/tools/python_api/test/test_database.py +234 -0
  80. real_ladybug-source/tools/python_api/test/test_datatype.py +372 -0
  81. real_ladybug-source/tools/python_api/test/test_df.py +564 -0
  82. real_ladybug-source/tools/python_api/test/test_dict.py +112 -0
  83. real_ladybug-source/tools/python_api/test/test_exception.py +54 -0
  84. real_ladybug-source/tools/python_api/test/test_fsm.py +227 -0
  85. real_ladybug-source/tools/python_api/test/test_get_header.py +49 -0
  86. real_ladybug-source/tools/python_api/test/test_helper.py +8 -0
  87. real_ladybug-source/tools/python_api/test/test_issue.py +147 -0
  88. real_ladybug-source/tools/python_api/test/test_iteration.py +96 -0
  89. real_ladybug-source/tools/python_api/test/test_networkx.py +437 -0
  90. real_ladybug-source/tools/python_api/test/test_parameter.py +340 -0
  91. real_ladybug-source/tools/python_api/test/test_prepared_statement.py +117 -0
  92. real_ladybug-source/tools/python_api/test/test_query_result.py +54 -0
  93. real_ladybug-source/tools/python_api/test/test_query_result_close.py +44 -0
  94. real_ladybug-source/tools/python_api/test/test_scan_pandas.py +676 -0
  95. real_ladybug-source/tools/python_api/test/test_scan_pandas_pyarrow.py +714 -0
  96. real_ladybug-source/tools/python_api/test/test_scan_polars.py +165 -0
  97. real_ladybug-source/tools/python_api/test/test_scan_pyarrow.py +167 -0
  98. real_ladybug-source/tools/python_api/test/test_timeout.py +11 -0
  99. real_ladybug-source/tools/python_api/test/test_torch_geometric.py +640 -0
  100. real_ladybug-source/tools/python_api/test/test_torch_geometric_remote_backend.py +111 -0
  101. real_ladybug-source/tools/python_api/test/test_udf.py +207 -0
  102. real_ladybug-source/tools/python_api/test/test_version.py +6 -0
  103. real_ladybug-source/tools/python_api/test/test_wal.py +80 -0
  104. real_ladybug-source/tools/python_api/test/type_aliases.py +10 -0
  105. real_ladybug-source/tools/rust_api/update_version.py +47 -0
  106. real_ladybug-source/tools/shell/test/conftest.py +218 -0
  107. real_ladybug-source/tools/shell/test/test_helper.py +60 -0
  108. real_ladybug-source/tools/shell/test/test_shell_basics.py +325 -0
  109. real_ladybug-source/tools/shell/test/test_shell_commands.py +656 -0
  110. real_ladybug-source/tools/shell/test/test_shell_control_edit.py +438 -0
  111. real_ladybug-source/tools/shell/test/test_shell_control_search.py +468 -0
  112. real_ladybug-source/tools/shell/test/test_shell_esc_edit.py +232 -0
  113. real_ladybug-source/tools/shell/test/test_shell_esc_search.py +162 -0
  114. real_ladybug-source/tools/shell/test/test_shell_flags.py +645 -0
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp311-cp311-win_amd64
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022-2025 Kùzu Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ build
2
+ real_ladybug
3
+ real_ladybug-source
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,2 @@
1
+ import hashlib, sys
2
+ print(hashlib.md5((''.join(open(sys.argv[1])) + ''.join(open(sys.argv[2]))).encode('utf-8')).hexdigest())
@@ -0,0 +1,47 @@
1
+ import sys
2
+ # arg 1 is input Cypher.g4
3
+ inputCypher = open(sys.argv[1], 'r')
4
+ # arg 2 is input keywords.txt
5
+ inputKeywords = [x[:-1] for x in open(sys.argv[2], 'r')]
6
+ # arg 3 is output Cypher.g4
7
+ outputCypher = open(sys.argv[3], 'w')
8
+ # arg 4 is output keywords.h
9
+ outputKeywords = open(sys.argv[4], 'w')
10
+
11
+ print("Generating keywords for Cypher.g4")
12
+ antlr4String = ''.join(map(
13
+ lambda x: x + ' : ' + ' '.join([f'( \'{i.upper()}\' | \'{i.lower()}\' )' if i != '_' else f'\'{i}\'' for i in x]) + ' ;\n\n',
14
+ inputKeywords))
15
+
16
+ cypherPrefixString = '''
17
+ /*
18
+ * OpenCypher grammar at "https://s3.amazonaws.com/artifacts.opencypher.org/legacy/Cypher.g4"
19
+ */
20
+ grammar Cypher;
21
+
22
+ // provide ad-hoc error messages for common syntax errors
23
+ @parser::declarations {
24
+ virtual void notifyQueryNotConcludeWithReturn(antlr4::Token* startToken) {};
25
+ virtual void notifyNodePatternWithoutParentheses(std::string nodeName, antlr4::Token* startToken) {};
26
+ virtual void notifyInvalidNotEqualOperator(antlr4::Token* startToken) {};
27
+ virtual void notifyEmptyToken(antlr4::Token* startToken) {};
28
+ virtual void notifyReturnNotAtEnd(antlr4::Token* startToken) {};
29
+ virtual void notifyNonBinaryComparison(antlr4::Token* startToken) {};
30
+ }
31
+
32
+ '''
33
+
34
+ outputCypher.write(cypherPrefixString + antlr4String + '\n' + ''.join(inputCypher))
35
+ print("keywords for Cypher.g4 generated")
36
+
37
+ print("Generating keywordList for keywords.h")
38
+ asCList = '{"' + '", "'.join(inputKeywords) + '"}'
39
+
40
+ outputKeywords.write(f'''#ifndef _keywordList
41
+ // clang-format off
42
+ #define _keywordList {asCList}
43
+ #define _keywordListLength {len(inputKeywords)}
44
+ // clang-format on
45
+ #endif
46
+ ''')
47
+ print("keywordList generated")
@@ -0,0 +1,68 @@
1
+ import os
2
+ import shutil
3
+ import platform
4
+
5
+ FILE_DIR = os.path.dirname(os.path.abspath(__file__))
6
+ DST_DIR = os.path.abspath(os.path.join(FILE_DIR, "..", "extension-artifacts"))
7
+ SRC_DIR = os.path.abspath(os.path.join(FILE_DIR, "..", "extension"))
8
+
9
+
10
+ def collect_exts():
11
+ for ext in os.listdir(SRC_DIR):
12
+ ext_build_path = os.path.abspath(os.path.join(SRC_DIR, ext, "build"))
13
+ if not os.path.exists(ext_build_path):
14
+ continue
15
+ print("Found extension: " + ext)
16
+ ext_dst_path = os.path.abspath(os.path.join(DST_DIR, ext))
17
+ os.makedirs(ext_dst_path, exist_ok=True)
18
+ for f in os.listdir(ext_build_path):
19
+ if not f.endswith(".lbug_extension"):
20
+ continue
21
+ ext_file_path = os.path.abspath(os.path.join(ext_build_path, f))
22
+ shutil.copy(ext_file_path, ext_dst_path)
23
+ print(" \tCopied: " + f, "=>", ext_dst_path)
24
+
25
+
26
+ def find_duckdb():
27
+ if platform.system() == "Darwin":
28
+ candidates = [
29
+ "/usr/local/lib/libduckdb.dylib",
30
+ "/opt/homebrew/lib/libduckdb.dylib",
31
+ ]
32
+ elif platform.system() == "Linux":
33
+ candidates = [
34
+ "/usr/local/lib/libduckdb.so",
35
+ "/usr/local/lib64/libduckdb.so",
36
+ "/usr/lib/libduckdb.so",
37
+ "/usr/lib64/libduckdb.so",
38
+ ]
39
+ elif platform.system() == "Windows":
40
+ candidates = [
41
+ "C:\\Program Files\\duckdb\\build\\release\\src\\Release\\duckdb.lib"
42
+ ]
43
+ for candidate in candidates:
44
+ if os.path.exists(candidate):
45
+ return os.path.abspath(candidate)
46
+ return None
47
+
48
+
49
+ def copy_duckdb():
50
+ duckdb_dst_path = os.path.abspath(os.path.join(DST_DIR, "common"))
51
+ os.makedirs(duckdb_dst_path, exist_ok=True)
52
+ duckdb_path = find_duckdb()
53
+ if duckdb_path is None:
54
+ print("DuckDB not found, copying is skipped")
55
+ return
56
+ shutil.copy(duckdb_path, duckdb_dst_path)
57
+ print("Copied DuckDB: " + duckdb_path, "=>", duckdb_dst_path)
58
+
59
+
60
+ def main():
61
+ shutil.rmtree(DST_DIR, ignore_errors=True)
62
+ os.makedirs(DST_DIR, exist_ok=True)
63
+ collect_exts()
64
+ copy_duckdb()
65
+
66
+
67
+ if __name__ == "__main__":
68
+ main()
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import graphlib
5
+ import os
6
+ import sys
7
+ import logging
8
+
9
+ from typing import Optional, Set
10
+ from pathlib import Path
11
+
12
+ logging.basicConfig(level=logging.WARNING)
13
+
14
+ BUILD_DIR = Path(sys.argv[1]).resolve()
15
+ SCRIPT_DIR = Path(__file__).parent
16
+ HEADER_BASE_PATH = (SCRIPT_DIR / "../src/include").resolve()
17
+ GENERATED_HEADERS_PATH = BUILD_DIR / "src/include"
18
+ MAIN_HEADER_PATH = HEADER_BASE_PATH / "main"
19
+ START_POINT = MAIN_HEADER_PATH / "lbug.h"
20
+ JSON_HEADER_PATH = (SCRIPT_DIR / "../third_party/nlohmann_json/json_fwd.hpp").resolve()
21
+ ALP_HEADERS_PATH = (SCRIPT_DIR / "../third_party/alp/include").resolve()
22
+ OUTPUT_PATH = "lbug.hpp"
23
+
24
+ logging.debug("HEADER_BASE_PATH: %s", HEADER_BASE_PATH)
25
+ logging.debug("MAIN_HEADER_PATH: %s", MAIN_HEADER_PATH)
26
+ logging.debug("START_POINT: %s", START_POINT)
27
+ logging.debug("JSON_HEADER_PATH: %s", JSON_HEADER_PATH)
28
+
29
+
30
+ def resolve_include(source_header: Path, include_path: str) -> Optional[Path]:
31
+ if include_path == "json_fwd.hpp":
32
+ return JSON_HEADER_PATH
33
+
34
+ current_directory_include = source_header.parent / include_path
35
+ if current_directory_include.exists():
36
+ return current_directory_include
37
+
38
+ main_directory_include = HEADER_BASE_PATH / include_path
39
+ if main_directory_include.exists():
40
+ return main_directory_include
41
+
42
+ generated_header_directory_include = GENERATED_HEADERS_PATH / include_path
43
+ if generated_header_directory_include.exists():
44
+ return generated_header_directory_include
45
+
46
+ alp_directory_include = ALP_HEADERS_PATH / include_path
47
+ if alp_directory_include.exists():
48
+ return alp_directory_include
49
+
50
+ return None
51
+
52
+
53
+ processed_headers: Set[Path] = set()
54
+ headers: Set[Path] = set()
55
+ with open(SCRIPT_DIR / "headers.txt") as file:
56
+ for path in file:
57
+ if not path.strip().startswith("#"):
58
+ header_path = Path(path.strip().replace("${BUILD_DIR}", str(BUILD_DIR)))
59
+ if not header_path.is_absolute():
60
+ header_path = SCRIPT_DIR / ".." / header_path
61
+ headers.add(header_path.resolve())
62
+
63
+
64
+ def build_graph(graph: graphlib.TopologicalSorter, source_file: Path) -> None:
65
+ assert source_file.is_absolute()
66
+ global processed_headers
67
+ if source_file in processed_headers:
68
+ return
69
+ processed_headers.add(source_file.resolve())
70
+
71
+ with source_file.open("r") as f:
72
+ for line in f.readlines():
73
+ if not line.startswith('#include "'):
74
+ continue
75
+ header_path = line.split('"')[1]
76
+ header_real_path = resolve_include(source_file, header_path)
77
+ if header_real_path is None:
78
+ logging.error(f"Could not find {header_path} included in {source_file}")
79
+ sys.exit(1)
80
+ logging.debug(
81
+ f"Resolved {header_path} in {source_file} to {header_real_path}"
82
+ )
83
+ graph.add(source_file, header_real_path)
84
+ build_graph(graph, header_real_path)
85
+
86
+
87
+ def create_merged_header():
88
+ graph = graphlib.TopologicalSorter()
89
+ logging.info("Building dependency graph...")
90
+ build_graph(graph, START_POINT)
91
+ if processed_headers != headers:
92
+ if processed_headers - headers:
93
+ error_string = os.linesep.join(
94
+ sorted("\t" + str(header) for header in processed_headers - headers)
95
+ )
96
+ raise RuntimeError(
97
+ "Extra headers were found in the include tree. "
98
+ "Double-check that these headers should be included in the single file header "
99
+ f"and if so, add them to headers.txt:{os.linesep}{error_string}"
100
+ )
101
+ if headers - processed_headers:
102
+ error_string = os.linesep.join(
103
+ sorted(str(header) for header in headers - processed_headers)
104
+ )
105
+ raise RuntimeError(
106
+ "Missing headers from the include tree. "
107
+ "Double-check that these headers are no longer needed in the single file header "
108
+ f"and if so, remove them from headers.txt:{os.linesep}{error_string}"
109
+ )
110
+ logging.info("Topological sorting...")
111
+ logging.info("Writing merged header...")
112
+ with open(OUTPUT_PATH, "w") as f:
113
+ f.write("#pragma once\n")
114
+ for header_path in graph.static_order():
115
+ with header_path.open() as f2:
116
+ for line in f2.readlines():
117
+ if not (
118
+ line.startswith("#pragma once") or line.startswith('#include "')
119
+ ):
120
+ f.write(line)
121
+
122
+ logging.info("Done!")
123
+
124
+
125
+ if __name__ == "__main__":
126
+ create_merged_header()
@@ -0,0 +1,101 @@
1
+ import argparse
2
+ import os
3
+ import sys
4
+ import subprocess
5
+
6
+
7
+ # Parse schema.cypher and copy.cypher files.
8
+ def create_cypher_queries(file_path):
9
+ commands = []
10
+ try:
11
+ with open(file_path, "r") as f:
12
+ for line in f:
13
+ stripped = line.strip()
14
+ if not stripped:
15
+ continue
16
+ if not stripped.endswith(";"):
17
+ stripped += ";"
18
+ commands.append(stripped)
19
+ except Exception:
20
+ pass
21
+ return commands
22
+
23
+
24
+ # Find all datasets that have a schema.cypher and copy.cypher file.
25
+ def find_valid_dataset_dirs(dataset_root):
26
+ valid_dirs = []
27
+
28
+ for root, dirs, files in os.walk(dataset_root):
29
+ # This script creates a tmp directory with the exported dbs, we should
30
+ # skip it in our search.
31
+ if "tmp" in root.split(os.sep):
32
+ continue
33
+ file_set = set(files)
34
+
35
+ if "schema.cypher" in file_set:
36
+ valid_dirs.append(root)
37
+
38
+ return valid_dirs
39
+
40
+
41
+ # Example scripts/export-dbs.py build/debug/tools/shell/lbug dataset.
42
+ def main():
43
+ parser = argparse.ArgumentParser(
44
+ description="Export DBs with LBUG shell and dataset paths"
45
+ )
46
+
47
+ parser.add_argument(
48
+ "--executable", required=True, help="Path to the LBUG shell executable"
49
+ )
50
+ parser.add_argument(
51
+ "--dataset-dir", required=True, help="Path to the dataset directory"
52
+ )
53
+ parser.add_argument(
54
+ "--output-dir", required=True, help="Path to export the datasets"
55
+ )
56
+ args = parser.parse_args()
57
+
58
+ arg_executable_path = os.path.abspath(args.executable)
59
+ arg_dataset_path = os.path.abspath(args.dataset_dir)
60
+ output_dir = os.path.abspath(args.output_dir)
61
+
62
+ if not os.path.isfile(arg_executable_path):
63
+ raise Exception(f"Error: Executable not found at {arg_executable_path}")
64
+ if not os.path.exists(arg_dataset_path):
65
+ raise Exception(f"Error: Dataset path not found at {arg_dataset_path}")
66
+
67
+ valid_datasets = find_valid_dataset_dirs(arg_dataset_path)
68
+ # This is done to construct a full path to replace the relative paths found
69
+ # in copy.cypher files.
70
+ script_dir = os.path.dirname(os.path.realpath(__file__))
71
+ root_dir = os.path.abspath(os.path.join(script_dir, ".."))
72
+ for dataset_path in valid_datasets:
73
+ schema_commands = create_cypher_queries(
74
+ os.path.join(dataset_path, "schema.cypher")
75
+ )
76
+ copy_commands = create_cypher_queries(os.path.join(dataset_path, "copy.cypher"))
77
+ combined_commands = schema_commands + copy_commands
78
+ dataset_name = os.path.relpath(dataset_path, arg_dataset_path)
79
+ export_path = os.path.join(output_dir, dataset_name)
80
+ export_command = (
81
+ f"EXPORT DATABASE '{export_path}' (format=\"csv\", header=true);"
82
+ )
83
+ combined_commands.append(export_command)
84
+ combined_commands.insert(0, "CALL threads=1;")
85
+ print(f"Exporting {dataset_path} to {export_path}")
86
+ joined_commands = "\n".join(cmd.strip() for cmd in combined_commands)
87
+
88
+ subprocess.run(
89
+ arg_executable_path,
90
+ input=joined_commands,
91
+ text=True,
92
+ cwd=root_dir,
93
+ check=True,
94
+ shell=True,
95
+ )
96
+
97
+ return 0
98
+
99
+
100
+ if __name__ == "__main__":
101
+ sys.exit(main())